feat(linter): rename @nx/eslint-plugin-nx to @nx/eslint-plugin (#16420)
This commit is contained in:
parent
9f4d02d968
commit
739b4c2924
@ -102,10 +102,10 @@ yarn.lock @FrozenPandaz @vsavkin @AgentEnder @jaysoo @JamesHenry
|
|||||||
/e2e/jest/** @barbados-clemens @FrozenPandaz
|
/e2e/jest/** @barbados-clemens @FrozenPandaz
|
||||||
|
|
||||||
# Linter
|
# Linter
|
||||||
/docs/generated/packages/eslint-plugin-nx/** @meeroslav @FrozenPandaz @JamesHenry
|
/docs/generated/packages/eslint-plugin/** @meeroslav @FrozenPandaz @JamesHenry
|
||||||
/docs/generated/packages/linter/** @meeroslav @FrozenPandaz @JamesHenry
|
/docs/generated/packages/linter/** @meeroslav @FrozenPandaz @JamesHenry
|
||||||
/docs/shared/packages/linter/** @meeroslav @FrozenPandaz @isaacplmann @juristr
|
/docs/shared/packages/linter/** @meeroslav @FrozenPandaz @isaacplmann @juristr
|
||||||
/packages/eslint-plugin-nx/** @meeroslav @FrozenPandaz @JamesHenry
|
/packages/eslint-plugin/** @meeroslav @FrozenPandaz @JamesHenry
|
||||||
/packages/linter/** @meeroslav @FrozenPandaz @JamesHenry
|
/packages/linter/** @meeroslav @FrozenPandaz @JamesHenry
|
||||||
/e2e/linter/** @meeroslav @FrozenPandaz
|
/e2e/linter/** @meeroslav @FrozenPandaz
|
||||||
.eslint* @meeroslav @FrozenPandaz @JamesHenry
|
.eslint* @meeroslav @FrozenPandaz @JamesHenry
|
||||||
|
|||||||
@ -4405,18 +4405,18 @@
|
|||||||
"disableCollapsible": false
|
"disableCollapsible": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "eslint-plugin-nx",
|
"id": "eslint-plugin",
|
||||||
"path": "/packages/eslint-plugin-nx",
|
"path": "/packages/eslint-plugin",
|
||||||
"name": "eslint-plugin-nx",
|
"name": "eslint-plugin",
|
||||||
"children": [
|
"children": [
|
||||||
{
|
{
|
||||||
"id": "documents",
|
"id": "documents",
|
||||||
"path": "/packages/eslint-plugin-nx/documents",
|
"path": "/packages/eslint-plugin/documents",
|
||||||
"name": "documents",
|
"name": "documents",
|
||||||
"children": [
|
"children": [
|
||||||
{
|
{
|
||||||
"name": "Overview",
|
"name": "Overview",
|
||||||
"path": "/packages/eslint-plugin-nx/documents/overview",
|
"path": "/packages/eslint-plugin/documents/overview",
|
||||||
"id": "overview",
|
"id": "overview",
|
||||||
"isExternal": false,
|
"isExternal": false,
|
||||||
"children": [],
|
"children": [],
|
||||||
@ -4424,7 +4424,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "The `enforce-module-boundaries` rule",
|
"name": "The `enforce-module-boundaries` rule",
|
||||||
"path": "/packages/eslint-plugin-nx/documents/enforce-module-boundaries",
|
"path": "/packages/eslint-plugin/documents/enforce-module-boundaries",
|
||||||
"id": "enforce-module-boundaries",
|
"id": "enforce-module-boundaries",
|
||||||
"isExternal": false,
|
"isExternal": false,
|
||||||
"children": [],
|
"children": [],
|
||||||
|
|||||||
@ -645,40 +645,40 @@
|
|||||||
},
|
},
|
||||||
"path": "/packages/esbuild"
|
"path": "/packages/esbuild"
|
||||||
},
|
},
|
||||||
"eslint-plugin-nx": {
|
"eslint-plugin": {
|
||||||
"githubRoot": "https://github.com/nrwl/nx/blob/master",
|
"githubRoot": "https://github.com/nrwl/nx/blob/master",
|
||||||
"name": "eslint-plugin-nx",
|
"name": "eslint-plugin",
|
||||||
"packageName": "@nrwl/eslint-plugin-nx",
|
"packageName": "@nrwl/eslint-plugin-nx",
|
||||||
"description": "The eslint-plugin-nx package is an ESLint plugin that contains a collection of recommended ESLint rule configurations which you can extend from in your own ESLint configs, as well as an Nx-specific lint rule called enforce-module-boundaries.",
|
"description": "The eslint-plugin package is an ESLint plugin that contains a collection of recommended ESLint rule configurations which you can extend from in your own ESLint configs, as well as an Nx-specific lint rule called enforce-module-boundaries.",
|
||||||
"documents": {
|
"documents": {
|
||||||
"/packages/eslint-plugin-nx/documents/overview": {
|
"/packages/eslint-plugin/documents/overview": {
|
||||||
"id": "overview",
|
"id": "overview",
|
||||||
"name": "Overview",
|
"name": "Overview",
|
||||||
"description": "The eslint-plugin-nx package is an ESLint plugin that contains a collection of recommended ESLint rule configurations which you can extend from in your own ESLint configs, as well as an Nx-specific lint rule called enforce-module-boundaries.",
|
"description": "The eslint-plugin package is an ESLint plugin that contains a collection of recommended ESLint rule configurations which you can extend from in your own ESLint configs, as well as an Nx-specific lint rule called enforce-module-boundaries.",
|
||||||
"file": "generated/packages/eslint-plugin-nx/documents/overview",
|
"file": "generated/packages/eslint-plugin/documents/overview",
|
||||||
"itemList": [],
|
"itemList": [],
|
||||||
"isExternal": false,
|
"isExternal": false,
|
||||||
"path": "/packages/eslint-plugin-nx/documents/overview",
|
"path": "/packages/eslint-plugin/documents/overview",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"originalFilePath": "shared/packages/linter/eslint-plugin-nx"
|
"originalFilePath": "shared/packages/linter/eslint-plugin"
|
||||||
},
|
},
|
||||||
"/packages/eslint-plugin-nx/documents/enforce-module-boundaries": {
|
"/packages/eslint-plugin/documents/enforce-module-boundaries": {
|
||||||
"id": "enforce-module-boundaries",
|
"id": "enforce-module-boundaries",
|
||||||
"name": "The `enforce-module-boundaries` rule",
|
"name": "The `enforce-module-boundaries` rule",
|
||||||
"description": "The eslint-plugin-nx package is an ESLint plugin that contains a collection of recommended ESLint rule configurations which you can extend from in your own ESLint configs, as well as an Nx-specific lint rule called enforce-module-boundaries.",
|
"description": "The eslint-plugin package is an ESLint plugin that contains a collection of recommended ESLint rule configurations which you can extend from in your own ESLint configs, as well as an Nx-specific lint rule called enforce-module-boundaries.",
|
||||||
"file": "generated/packages/eslint-plugin-nx/documents/enforce-module-boundaries",
|
"file": "generated/packages/eslint-plugin/documents/enforce-module-boundaries",
|
||||||
"itemList": [],
|
"itemList": [],
|
||||||
"isExternal": false,
|
"isExternal": false,
|
||||||
"path": "/packages/eslint-plugin-nx/documents/enforce-module-boundaries",
|
"path": "/packages/eslint-plugin/documents/enforce-module-boundaries",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"originalFilePath": "shared/packages/linter/enforce-module-boundaries"
|
"originalFilePath": "shared/packages/linter/enforce-module-boundaries"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": "/packages/eslint-plugin-nx",
|
"root": "/packages/eslint-plugin",
|
||||||
"source": "/packages/eslint-plugin-nx/src",
|
"source": "/packages/eslint-plugin/src",
|
||||||
"executors": {},
|
"executors": {},
|
||||||
"generators": {},
|
"generators": {},
|
||||||
"path": "/packages/eslint-plugin-nx"
|
"path": "/packages/eslint-plugin"
|
||||||
},
|
},
|
||||||
"expo": {
|
"expo": {
|
||||||
"githubRoot": "https://github.com/nrwl/nx/blob/master",
|
"githubRoot": "https://github.com/nrwl/nx/blob/master",
|
||||||
|
|||||||
@ -639,27 +639,27 @@
|
|||||||
"source": "/packages/esbuild/src"
|
"source": "/packages/esbuild/src"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "The eslint-plugin-nx package is an ESLint plugin that contains a collection of recommended ESLint rule configurations which you can extend from in your own ESLint configs, as well as an Nx-specific lint rule called enforce-module-boundaries.",
|
"description": "The eslint-plugin package is an ESLint plugin that contains a collection of recommended ESLint rule configurations which you can extend from in your own ESLint configs, as well as an Nx-specific lint rule called enforce-module-boundaries.",
|
||||||
"documents": [
|
"documents": [
|
||||||
{
|
{
|
||||||
"id": "overview",
|
"id": "overview",
|
||||||
"name": "Overview",
|
"name": "Overview",
|
||||||
"description": "The eslint-plugin-nx package is an ESLint plugin that contains a collection of recommended ESLint rule configurations which you can extend from in your own ESLint configs, as well as an Nx-specific lint rule called enforce-module-boundaries.",
|
"description": "The eslint-plugin package is an ESLint plugin that contains a collection of recommended ESLint rule configurations which you can extend from in your own ESLint configs, as well as an Nx-specific lint rule called enforce-module-boundaries.",
|
||||||
"file": "generated/packages/eslint-plugin-nx/documents/overview",
|
"file": "generated/packages/eslint-plugin/documents/overview",
|
||||||
"itemList": [],
|
"itemList": [],
|
||||||
"isExternal": false,
|
"isExternal": false,
|
||||||
"path": "eslint-plugin-nx/documents/overview",
|
"path": "eslint-plugin/documents/overview",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"originalFilePath": "shared/packages/linter/eslint-plugin-nx"
|
"originalFilePath": "shared/packages/linter/eslint-plugin"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "enforce-module-boundaries",
|
"id": "enforce-module-boundaries",
|
||||||
"name": "The `enforce-module-boundaries` rule",
|
"name": "The `enforce-module-boundaries` rule",
|
||||||
"description": "The eslint-plugin-nx package is an ESLint plugin that contains a collection of recommended ESLint rule configurations which you can extend from in your own ESLint configs, as well as an Nx-specific lint rule called enforce-module-boundaries.",
|
"description": "The eslint-plugin package is an ESLint plugin that contains a collection of recommended ESLint rule configurations which you can extend from in your own ESLint configs, as well as an Nx-specific lint rule called enforce-module-boundaries.",
|
||||||
"file": "generated/packages/eslint-plugin-nx/documents/enforce-module-boundaries",
|
"file": "generated/packages/eslint-plugin/documents/enforce-module-boundaries",
|
||||||
"itemList": [],
|
"itemList": [],
|
||||||
"isExternal": false,
|
"isExternal": false,
|
||||||
"path": "eslint-plugin-nx/documents/enforce-module-boundaries",
|
"path": "eslint-plugin/documents/enforce-module-boundaries",
|
||||||
"tags": [],
|
"tags": [],
|
||||||
"originalFilePath": "shared/packages/linter/enforce-module-boundaries"
|
"originalFilePath": "shared/packages/linter/enforce-module-boundaries"
|
||||||
}
|
}
|
||||||
@ -667,10 +667,10 @@
|
|||||||
"executors": [],
|
"executors": [],
|
||||||
"generators": [],
|
"generators": [],
|
||||||
"githubRoot": "https://github.com/nrwl/nx/blob/master",
|
"githubRoot": "https://github.com/nrwl/nx/blob/master",
|
||||||
"name": "eslint-plugin-nx",
|
"name": "eslint-plugin",
|
||||||
"packageName": "@nrwl/eslint-plugin-nx",
|
"packageName": "@nrwl/eslint-plugin-nx",
|
||||||
"root": "/packages/eslint-plugin-nx",
|
"root": "/packages/eslint-plugin",
|
||||||
"source": "/packages/eslint-plugin-nx/src"
|
"source": "/packages/eslint-plugin/src"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "The Expo Plugin for Nx contains executors and generators for managing and developing an expo application within your workspace. For example, you can directly build for different target platforms as well as generate projects and publish your code.",
|
"description": "The Expo Plugin for Nx contains executors and generators for managing and developing an expo application within your workspace. For example, you can directly build for different target platforms as well as generate projects and publish your code.",
|
||||||
|
|||||||
@ -54,4 +54,4 @@ You can also use `@nrwl/nx/react` which includes all three `@nrwl/nx/react-*` pl
|
|||||||
|
|
||||||
### Enforce Module Boundaries rule
|
### Enforce Module Boundaries rule
|
||||||
|
|
||||||
The `enforce-module-boundaries` ESLint rule enables you to define strict rules for accessing resources between different projects in the repository. Enforcing strict boundaries helps keep prevent unplanned cross-dependencies. Read more about it on a [dedicated page](/packages/eslint-plugin-nx/documents/enforce-module-boundaries)
|
The `enforce-module-boundaries` ESLint rule enables you to define strict rules for accessing resources between different projects in the repository. Enforcing strict boundaries helps keep prevent unplanned cross-dependencies. Read more about it on a [dedicated page](/packages/eslint-plugin/documents/enforce-module-boundaries)
|
||||||
@ -32,4 +32,4 @@ nx lint my-lib
|
|||||||
|
|
||||||
## ESLint plugin
|
## ESLint plugin
|
||||||
|
|
||||||
Read about our dedicated ESLint plugin - [eslint-plugin-nx](/packages/eslint-plugin-nx/documents/overview).
|
Read about our dedicated ESLint plugin - [eslint-plugin-nx](/packages/eslint-plugin/documents/overview).
|
||||||
|
|||||||
@ -1926,20 +1926,20 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "eslint-plugin-nx",
|
"name": "eslint-plugin",
|
||||||
"id": "eslint-plugin-nx",
|
"id": "eslint-plugin",
|
||||||
"description": "ESLint plugin package.",
|
"description": "ESLint plugin package.",
|
||||||
"itemList": [
|
"itemList": [
|
||||||
{
|
{
|
||||||
"id": "overview",
|
"id": "overview",
|
||||||
"name": "Overview",
|
"name": "Overview",
|
||||||
"path": "/packages/eslint-plugin-nx",
|
"path": "/packages/eslint-plugin",
|
||||||
"file": "shared/packages/linter/eslint-plugin-nx"
|
"file": "shared/packages/linter/eslint-plugin"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "enforce-module-boundaries",
|
"id": "enforce-module-boundaries",
|
||||||
"name": "The `enforce-module-boundaries` rule",
|
"name": "The `enforce-module-boundaries` rule",
|
||||||
"path": "/packages/eslint-plugin-nx",
|
"path": "/packages/eslint-plugin",
|
||||||
"file": "shared/packages/linter/enforce-module-boundaries"
|
"file": "shared/packages/linter/enforce-module-boundaries"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@ -108,10 +108,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "eslint-plugin-nx",
|
"name": "eslint-plugin",
|
||||||
"packageName": "eslint-plugin-nx",
|
"packageName": "eslint-plugin",
|
||||||
"description": "The eslint-plugin-nx package is an ESLint plugin that contains a collection of recommended ESLint rule configurations which you can extend from in your own ESLint configs, as well as an Nx-specific lint rule called enforce-module-boundaries.",
|
"description": "The eslint-plugin package is an ESLint plugin that contains a collection of recommended ESLint rule configurations which you can extend from in your own ESLint configs, as well as an Nx-specific lint rule called enforce-module-boundaries.",
|
||||||
"path": "generated/packages/eslint-plugin-nx.json",
|
"path": "generated/packages/eslint-plugin.json",
|
||||||
"schemas": { "executors": [], "generators": [] }
|
"schemas": { "executors": [], "generators": [] }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -54,4 +54,4 @@ You can also use `@nrwl/nx/react` which includes all three `@nrwl/nx/react-*` pl
|
|||||||
|
|
||||||
### Enforce Module Boundaries rule
|
### Enforce Module Boundaries rule
|
||||||
|
|
||||||
The `enforce-module-boundaries` ESLint rule enables you to define strict rules for accessing resources between different projects in the repository. Enforcing strict boundaries helps keep prevent unplanned cross-dependencies. Read more about it on a [dedicated page](/packages/eslint-plugin-nx/documents/enforce-module-boundaries)
|
The `enforce-module-boundaries` ESLint rule enables you to define strict rules for accessing resources between different projects in the repository. Enforcing strict boundaries helps keep prevent unplanned cross-dependencies. Read more about it on a [dedicated page](/packages/eslint-plugin/documents/enforce-module-boundaries)
|
||||||
@ -32,4 +32,4 @@ nx lint my-lib
|
|||||||
|
|
||||||
## ESLint plugin
|
## ESLint plugin
|
||||||
|
|
||||||
Read about our dedicated ESLint plugin - [eslint-plugin-nx](/packages/eslint-plugin-nx/documents/overview).
|
Read about our dedicated ESLint plugin - [eslint-plugin-nx](/packages/eslint-plugin/documents/overview).
|
||||||
|
|||||||
@ -168,7 +168,7 @@ describe('Linter', () => {
|
|||||||
);
|
);
|
||||||
updateFile(newRulePath, updatedRuleContents);
|
updateFile(newRulePath, updatedRuleContents);
|
||||||
|
|
||||||
const newRuleNameForUsage = `@nx/nx/workspace/${newRuleName}`;
|
const newRuleNameForUsage = `@nx/workspace/${newRuleName}`;
|
||||||
|
|
||||||
// Add the new workspace rule to the lint config and run linting
|
// Add the new workspace rule to the lint config and run linting
|
||||||
const eslintrc = readJson('.eslintrc.json');
|
const eslintrc = readJson('.eslintrc.json');
|
||||||
@ -199,10 +199,10 @@ describe('Linter', () => {
|
|||||||
|
|
||||||
const eslint = readJson('.eslintrc.json');
|
const eslint = readJson('.eslintrc.json');
|
||||||
eslint.overrides[0].rules[
|
eslint.overrides[0].rules[
|
||||||
'@nx/nx/enforce-module-boundaries'
|
'@nx/enforce-module-boundaries'
|
||||||
][1].depConstraints = [
|
][1].depConstraints = [
|
||||||
{ sourceTag: 'validtag', onlyDependOnLibsWithTags: ['validtag'] },
|
{ sourceTag: 'validtag', onlyDependOnLibsWithTags: ['validtag'] },
|
||||||
...eslint.overrides[0].rules['@nx/nx/enforce-module-boundaries'][1]
|
...eslint.overrides[0].rules['@nx/enforce-module-boundaries'][1]
|
||||||
.depConstraints,
|
.depConstraints,
|
||||||
];
|
];
|
||||||
updateFile('.eslintrc.json', JSON.stringify(eslint, null, 2));
|
updateFile('.eslintrc.json', JSON.stringify(eslint, null, 2));
|
||||||
@ -454,8 +454,8 @@ describe('Linter', () => {
|
|||||||
const e2eEslint = readJson('e2e/.eslintrc.json');
|
const e2eEslint = readJson('e2e/.eslintrc.json');
|
||||||
|
|
||||||
// should directly refer to nx plugin
|
// should directly refer to nx plugin
|
||||||
expect(rootEslint.plugins).toEqual(['@nx/nx']);
|
expect(rootEslint.plugins).toEqual(['@nx']);
|
||||||
expect(e2eEslint.plugins).toEqual(['@nx/nx']);
|
expect(e2eEslint.plugins).toEqual(['@nx']);
|
||||||
}
|
}
|
||||||
|
|
||||||
function verifySuccessfulMigratedSetup(myapp: string, mylib: string) {
|
function verifySuccessfulMigratedSetup(myapp: string, mylib: string) {
|
||||||
@ -476,7 +476,7 @@ describe('Linter', () => {
|
|||||||
const libEslint = readJson(`libs/${mylib}/.eslintrc.json`);
|
const libEslint = readJson(`libs/${mylib}/.eslintrc.json`);
|
||||||
|
|
||||||
// should directly refer to nx plugin
|
// should directly refer to nx plugin
|
||||||
expect(rootEslint.plugins).toEqual(['@nx/nx']);
|
expect(rootEslint.plugins).toEqual(['@nx']);
|
||||||
expect(appEslint.plugins).toBeUndefined();
|
expect(appEslint.plugins).toBeUndefined();
|
||||||
expect(e2eEslint.plugins).toBeUndefined();
|
expect(e2eEslint.plugins).toBeUndefined();
|
||||||
expect(libEslint.plugins).toBeUndefined();
|
expect(libEslint.plugins).toBeUndefined();
|
||||||
@ -541,7 +541,7 @@ describe('Linter', () => {
|
|||||||
|
|
||||||
// should have no plugin extends
|
// should have no plugin extends
|
||||||
expect(appEslint.overrides[0].extends).toEqual([
|
expect(appEslint.overrides[0].extends).toEqual([
|
||||||
'plugin:@nx/nx/angular',
|
'plugin:@nx/angular',
|
||||||
'plugin:@angular-eslint/template/process-inline-templates',
|
'plugin:@angular-eslint/template/process-inline-templates',
|
||||||
]);
|
]);
|
||||||
expect(e2eEslint.overrides[0].extends).toBeUndefined();
|
expect(e2eEslint.overrides[0].extends).toBeUndefined();
|
||||||
|
|||||||
@ -125,7 +125,7 @@ describe('nx-dev: Packages Section', () => {
|
|||||||
title: '@nrwl/esbuild:esbuild',
|
title: '@nrwl/esbuild:esbuild',
|
||||||
path: '/packages/esbuild/executors/esbuild',
|
path: '/packages/esbuild/executors/esbuild',
|
||||||
},
|
},
|
||||||
{ title: '@nrwl/eslint-plugin-nx', path: '/packages/eslint-plugin-nx' },
|
{ title: '@nrwl/eslint-plugin', path: '/packages/eslint-plugin' },
|
||||||
{ title: '@nrwl/expo', path: '/packages/expo' },
|
{ title: '@nrwl/expo', path: '/packages/expo' },
|
||||||
{
|
{
|
||||||
title: '@nrwl/expo:init',
|
title: '@nrwl/expo:init',
|
||||||
|
|||||||
@ -433,7 +433,7 @@ const packagesIndexes = {
|
|||||||
'/cypress': '/packages/cypress',
|
'/cypress': '/packages/cypress',
|
||||||
'/detox': '/packages/detox',
|
'/detox': '/packages/detox',
|
||||||
'/esbuild': '/packages/esbuild',
|
'/esbuild': '/packages/esbuild',
|
||||||
'/eslint-plugin-nx': '/packages/eslint',
|
'/eslint-plugin-nx': '/packages/eslint-plugin-nx',
|
||||||
'/expo': '/packages/expo',
|
'/expo': '/packages/expo',
|
||||||
'/express': '/packages/express',
|
'/express': '/packages/express',
|
||||||
'/jest': '/packages/jest',
|
'/jest': '/packages/jest',
|
||||||
@ -518,6 +518,11 @@ const packagesDocuments = {
|
|||||||
'/packages/add-nx-to-monorepo': '/packages/nx/documents/init',
|
'/packages/add-nx-to-monorepo': '/packages/nx/documents/init',
|
||||||
'/packages/cra-to-nx': '/packages/nx/documents/init',
|
'/packages/cra-to-nx': '/packages/nx/documents/init',
|
||||||
'/packages/make-angular-cli-faster': '/packages/nx/documents/init',
|
'/packages/make-angular-cli-faster': '/packages/nx/documents/init',
|
||||||
|
'/packages/eslint-plugin-nx': '/packages/eslint-plugin',
|
||||||
|
'/packages/eslint-plugin-nx/documents/enforce-module-boundaries':
|
||||||
|
'/packages/eslint-plugin/documents/enforce-module-boundaries',
|
||||||
|
'/packages/eslint-plugin-nx/documents/overview':
|
||||||
|
'/packages/eslint-plugin/documents/overview',
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -5,7 +5,7 @@ export const iconsMap: Record<string, string> = {
|
|||||||
detox: '/images/icons/react.svg',
|
detox: '/images/icons/react.svg',
|
||||||
devkit: '/images/icons/nx.svg',
|
devkit: '/images/icons/nx.svg',
|
||||||
esbuild: '/images/icons/esbuild.svg',
|
esbuild: '/images/icons/esbuild.svg',
|
||||||
'eslint-plugin-nx': '/images/icons/eslint.svg',
|
'eslint-plugin': '/images/icons/eslint.svg',
|
||||||
expo: '/images/icons/expo.svg',
|
expo: '/images/icons/expo.svg',
|
||||||
express: '/images/icons/express.svg',
|
express: '/images/icons/express.svg',
|
||||||
jest: '/images/icons/jest.svg',
|
jest: '/images/icons/jest.svg',
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
## @nrwl/eslint-plugin-nx has been deprecated!
|
## @nrwl/eslint-plugin-nx has been deprecated!
|
||||||
|
|
||||||
@nrwl/eslint-plugin-nx has been deprecated in favor of [@nx/eslint-plugin-nx](https://www.npmjs.com/package/@nx/eslint-plugin-nx). Please use that instead.
|
@nrwl/eslint-plugin-nx has been deprecated in favor of [@nx/eslint-plugin](https://www.npmjs.com/package/@nx/eslint-plugin). Please use that instead.
|
||||||
|
|
||||||
@nrwl/eslint-plugin-nx will no longer be published in Nx v17.
|
@nrwl/eslint-plugin-nx will no longer be published in Nx v17.
|
||||||
|
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
export * from '@nx/eslint-plugin-nx';
|
export * from '@nx/eslint-plugin';
|
||||||
|
|||||||
@ -24,7 +24,7 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://nx.dev",
|
"homepage": "https://nx.dev",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nx/eslint-plugin-nx": "file:../../packages/eslint-plugin-nx"
|
"@nx/eslint-plugin": "file:../../packages/eslint-plugin"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
|
|||||||
@ -32,6 +32,5 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
"implicitDependencies": ["eslint-plugin-nx"]
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,7 @@ exports[`addLinting generator should correctly generate the .eslintrc.json file
|
|||||||
"overrides": [
|
"overrides": [
|
||||||
{
|
{
|
||||||
"extends": [
|
"extends": [
|
||||||
"plugin:@nx/nx/angular",
|
"plugin:@nx/angular",
|
||||||
"plugin:@angular-eslint/template/process-inline-templates",
|
"plugin:@angular-eslint/template/process-inline-templates",
|
||||||
],
|
],
|
||||||
"files": [
|
"files": [
|
||||||
@ -38,7 +38,7 @@ exports[`addLinting generator should correctly generate the .eslintrc.json file
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"extends": [
|
"extends": [
|
||||||
"plugin:@nx/nx/angular-template",
|
"plugin:@nx/angular-template",
|
||||||
],
|
],
|
||||||
"files": [
|
"files": [
|
||||||
"*.html",
|
"*.html",
|
||||||
@ -60,7 +60,7 @@ exports[`addLinting generator support angular v14 should correctly generate the
|
|||||||
"overrides": [
|
"overrides": [
|
||||||
{
|
{
|
||||||
"extends": [
|
"extends": [
|
||||||
"plugin:@nx/nx/angular",
|
"plugin:@nx/angular",
|
||||||
"plugin:@angular-eslint/template/process-inline-templates",
|
"plugin:@angular-eslint/template/process-inline-templates",
|
||||||
],
|
],
|
||||||
"files": [
|
"files": [
|
||||||
@ -87,7 +87,7 @@ exports[`addLinting generator support angular v14 should correctly generate the
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"extends": [
|
"extends": [
|
||||||
"plugin:@nx/nx/angular-template",
|
"plugin:@nx/angular-template",
|
||||||
],
|
],
|
||||||
"files": [
|
"files": [
|
||||||
"*.html",
|
"*.html",
|
||||||
|
|||||||
@ -18,7 +18,7 @@ export const extendAngularEslintJson = (
|
|||||||
files: ['*.ts'],
|
files: ['*.ts'],
|
||||||
extends: [
|
extends: [
|
||||||
...(json.overrides[0].extends || []),
|
...(json.overrides[0].extends || []),
|
||||||
'plugin:@nx/nx/angular',
|
'plugin:@nx/angular',
|
||||||
'plugin:@angular-eslint/template/process-inline-templates',
|
'plugin:@angular-eslint/template/process-inline-templates',
|
||||||
],
|
],
|
||||||
rules: {
|
rules: {
|
||||||
@ -42,7 +42,7 @@ export const extendAngularEslintJson = (
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
files: ['*.html'],
|
files: ['*.html'],
|
||||||
extends: ['plugin:@nx/nx/angular-template'],
|
extends: ['plugin:@nx/angular-template'],
|
||||||
/**
|
/**
|
||||||
* Having an empty rules object present makes it more obvious to the user where they would
|
* Having an empty rules object present makes it more obvious to the user where they would
|
||||||
* extend things from if they needed to
|
* extend things from if they needed to
|
||||||
@ -75,7 +75,7 @@ export function createEsLintConfiguration(
|
|||||||
{
|
{
|
||||||
files: ['*.ts'],
|
files: ['*.ts'],
|
||||||
extends: [
|
extends: [
|
||||||
'plugin:@nx/nx/angular',
|
'plugin:@nx/angular',
|
||||||
'plugin:@angular-eslint/template/process-inline-templates',
|
'plugin:@angular-eslint/template/process-inline-templates',
|
||||||
],
|
],
|
||||||
/**
|
/**
|
||||||
@ -117,7 +117,7 @@ export function createEsLintConfiguration(
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
files: ['*.html'],
|
files: ['*.html'],
|
||||||
extends: ['plugin:@nx/nx/angular-template'],
|
extends: ['plugin:@nx/angular-template'],
|
||||||
/**
|
/**
|
||||||
* Having an empty rules object present makes it more obvious to the user where they would
|
* Having an empty rules object present makes it more obvious to the user where they would
|
||||||
* extend things from if they needed to
|
* extend things from if they needed to
|
||||||
|
|||||||
@ -506,7 +506,7 @@ describe('app', () => {
|
|||||||
"overrides": [
|
"overrides": [
|
||||||
{
|
{
|
||||||
"extends": [
|
"extends": [
|
||||||
"plugin:@nx/nx/angular",
|
"plugin:@nx/angular",
|
||||||
"plugin:@angular-eslint/template/process-inline-templates",
|
"plugin:@angular-eslint/template/process-inline-templates",
|
||||||
],
|
],
|
||||||
"files": [
|
"files": [
|
||||||
@ -533,7 +533,7 @@ describe('app', () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"extends": [
|
"extends": [
|
||||||
"plugin:@nx/nx/angular-template",
|
"plugin:@nx/angular-template",
|
||||||
],
|
],
|
||||||
"files": [
|
"files": [
|
||||||
"*.html",
|
"*.html",
|
||||||
|
|||||||
@ -14,7 +14,7 @@ exports[`convert-tslint-to-eslint should not override .eslint config if migratio
|
|||||||
"*.jsx",
|
"*.jsx",
|
||||||
],
|
],
|
||||||
"rules": {
|
"rules": {
|
||||||
"@nx/nx/enforce-module-boundaries": [
|
"@nx/enforce-module-boundaries": [
|
||||||
"error",
|
"error",
|
||||||
{
|
{
|
||||||
"allow": [
|
"allow": [
|
||||||
@ -92,7 +92,7 @@ exports[`convert-tslint-to-eslint should not override .eslint config if migratio
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"extends": [
|
"extends": [
|
||||||
"plugin:@nx/nx/typescript",
|
"plugin:@nx/typescript",
|
||||||
],
|
],
|
||||||
"files": [
|
"files": [
|
||||||
"*.ts",
|
"*.ts",
|
||||||
@ -102,7 +102,7 @@ exports[`convert-tslint-to-eslint should not override .eslint config if migratio
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"extends": [
|
"extends": [
|
||||||
"plugin:@nx/nx/javascript",
|
"plugin:@nx/javascript",
|
||||||
],
|
],
|
||||||
"files": [
|
"files": [
|
||||||
"*.js",
|
"*.js",
|
||||||
@ -238,7 +238,7 @@ exports[`convert-tslint-to-eslint should not override .eslint config if migratio
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"@nx/nx",
|
"@nx",
|
||||||
],
|
],
|
||||||
"root": true,
|
"root": true,
|
||||||
}
|
}
|
||||||
@ -255,7 +255,7 @@ exports[`convert-tslint-to-eslint should not override .eslint config if migratio
|
|||||||
"overrides": [
|
"overrides": [
|
||||||
{
|
{
|
||||||
"extends": [
|
"extends": [
|
||||||
"plugin:@nx/nx/angular",
|
"plugin:@nx/angular",
|
||||||
"plugin:@angular-eslint/template/process-inline-templates",
|
"plugin:@angular-eslint/template/process-inline-templates",
|
||||||
],
|
],
|
||||||
"files": [
|
"files": [
|
||||||
@ -287,7 +287,7 @@ exports[`convert-tslint-to-eslint should not override .eslint config if migratio
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"extends": [
|
"extends": [
|
||||||
"plugin:@nx/nx/angular-template",
|
"plugin:@nx/angular-template",
|
||||||
],
|
],
|
||||||
"files": [
|
"files": [
|
||||||
"*.html",
|
"*.html",
|
||||||
@ -317,7 +317,7 @@ exports[`convert-tslint-to-eslint should not override .eslint config if migratio
|
|||||||
"*.jsx",
|
"*.jsx",
|
||||||
],
|
],
|
||||||
"rules": {
|
"rules": {
|
||||||
"@nx/nx/enforce-module-boundaries": [
|
"@nx/enforce-module-boundaries": [
|
||||||
"error",
|
"error",
|
||||||
{
|
{
|
||||||
"allow": [
|
"allow": [
|
||||||
@ -395,7 +395,7 @@ exports[`convert-tslint-to-eslint should not override .eslint config if migratio
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"extends": [
|
"extends": [
|
||||||
"plugin:@nx/nx/typescript",
|
"plugin:@nx/typescript",
|
||||||
],
|
],
|
||||||
"files": [
|
"files": [
|
||||||
"*.ts",
|
"*.ts",
|
||||||
@ -405,7 +405,7 @@ exports[`convert-tslint-to-eslint should not override .eslint config if migratio
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"extends": [
|
"extends": [
|
||||||
"plugin:@nx/nx/javascript",
|
"plugin:@nx/javascript",
|
||||||
],
|
],
|
||||||
"files": [
|
"files": [
|
||||||
"*.js",
|
"*.js",
|
||||||
@ -541,7 +541,7 @@ exports[`convert-tslint-to-eslint should not override .eslint config if migratio
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"@nx/nx",
|
"@nx",
|
||||||
],
|
],
|
||||||
"root": true,
|
"root": true,
|
||||||
}
|
}
|
||||||
@ -554,7 +554,7 @@ exports[`convert-tslint-to-eslint should work for Angular applications 1`] = `
|
|||||||
"@angular-eslint/eslint-plugin": "~15.0.0",
|
"@angular-eslint/eslint-plugin": "~15.0.0",
|
||||||
"@angular-eslint/eslint-plugin-template": "~15.0.0",
|
"@angular-eslint/eslint-plugin-template": "~15.0.0",
|
||||||
"@angular-eslint/template-parser": "~15.0.0",
|
"@angular-eslint/template-parser": "~15.0.0",
|
||||||
"@nx/eslint-plugin-nx": "0.0.1",
|
"@nx/eslint-plugin": "0.0.1",
|
||||||
"@nx/linter": "0.0.1",
|
"@nx/linter": "0.0.1",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.58.0",
|
"@typescript-eslint/eslint-plugin": "^5.58.0",
|
||||||
"@typescript-eslint/parser": "^5.58.0",
|
"@typescript-eslint/parser": "^5.58.0",
|
||||||
@ -604,7 +604,7 @@ exports[`convert-tslint-to-eslint should work for Angular applications 3`] = `
|
|||||||
"*.jsx",
|
"*.jsx",
|
||||||
],
|
],
|
||||||
"rules": {
|
"rules": {
|
||||||
"@nx/nx/enforce-module-boundaries": [
|
"@nx/enforce-module-boundaries": [
|
||||||
"error",
|
"error",
|
||||||
{
|
{
|
||||||
"allow": [
|
"allow": [
|
||||||
@ -682,7 +682,7 @@ exports[`convert-tslint-to-eslint should work for Angular applications 3`] = `
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"extends": [
|
"extends": [
|
||||||
"plugin:@nx/nx/typescript",
|
"plugin:@nx/typescript",
|
||||||
],
|
],
|
||||||
"files": [
|
"files": [
|
||||||
"*.ts",
|
"*.ts",
|
||||||
@ -692,7 +692,7 @@ exports[`convert-tslint-to-eslint should work for Angular applications 3`] = `
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"extends": [
|
"extends": [
|
||||||
"plugin:@nx/nx/javascript",
|
"plugin:@nx/javascript",
|
||||||
],
|
],
|
||||||
"files": [
|
"files": [
|
||||||
"*.js",
|
"*.js",
|
||||||
@ -828,7 +828,7 @@ exports[`convert-tslint-to-eslint should work for Angular applications 3`] = `
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"@nx/nx",
|
"@nx",
|
||||||
],
|
],
|
||||||
"root": true,
|
"root": true,
|
||||||
}
|
}
|
||||||
@ -845,7 +845,7 @@ exports[`convert-tslint-to-eslint should work for Angular applications 4`] = `
|
|||||||
"overrides": [
|
"overrides": [
|
||||||
{
|
{
|
||||||
"extends": [
|
"extends": [
|
||||||
"plugin:@nx/nx/angular",
|
"plugin:@nx/angular",
|
||||||
"plugin:@angular-eslint/template/process-inline-templates",
|
"plugin:@angular-eslint/template/process-inline-templates",
|
||||||
],
|
],
|
||||||
"files": [
|
"files": [
|
||||||
@ -883,7 +883,7 @@ exports[`convert-tslint-to-eslint should work for Angular applications 4`] = `
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"extends": [
|
"extends": [
|
||||||
"plugin:@nx/nx/angular-template",
|
"plugin:@nx/angular-template",
|
||||||
],
|
],
|
||||||
"files": [
|
"files": [
|
||||||
"*.html",
|
"*.html",
|
||||||
@ -906,7 +906,7 @@ exports[`convert-tslint-to-eslint should work for Angular libraries 1`] = `
|
|||||||
"@angular-eslint/eslint-plugin": "~15.0.0",
|
"@angular-eslint/eslint-plugin": "~15.0.0",
|
||||||
"@angular-eslint/eslint-plugin-template": "~15.0.0",
|
"@angular-eslint/eslint-plugin-template": "~15.0.0",
|
||||||
"@angular-eslint/template-parser": "~15.0.0",
|
"@angular-eslint/template-parser": "~15.0.0",
|
||||||
"@nx/eslint-plugin-nx": "0.0.1",
|
"@nx/eslint-plugin": "0.0.1",
|
||||||
"@nx/linter": "0.0.1",
|
"@nx/linter": "0.0.1",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.58.0",
|
"@typescript-eslint/eslint-plugin": "^5.58.0",
|
||||||
"@typescript-eslint/parser": "^5.58.0",
|
"@typescript-eslint/parser": "^5.58.0",
|
||||||
@ -956,7 +956,7 @@ exports[`convert-tslint-to-eslint should work for Angular libraries 3`] = `
|
|||||||
"*.jsx",
|
"*.jsx",
|
||||||
],
|
],
|
||||||
"rules": {
|
"rules": {
|
||||||
"@nx/nx/enforce-module-boundaries": [
|
"@nx/enforce-module-boundaries": [
|
||||||
"error",
|
"error",
|
||||||
{
|
{
|
||||||
"allow": [
|
"allow": [
|
||||||
@ -1034,7 +1034,7 @@ exports[`convert-tslint-to-eslint should work for Angular libraries 3`] = `
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"extends": [
|
"extends": [
|
||||||
"plugin:@nx/nx/typescript",
|
"plugin:@nx/typescript",
|
||||||
],
|
],
|
||||||
"files": [
|
"files": [
|
||||||
"*.ts",
|
"*.ts",
|
||||||
@ -1044,7 +1044,7 @@ exports[`convert-tslint-to-eslint should work for Angular libraries 3`] = `
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"extends": [
|
"extends": [
|
||||||
"plugin:@nx/nx/javascript",
|
"plugin:@nx/javascript",
|
||||||
],
|
],
|
||||||
"files": [
|
"files": [
|
||||||
"*.js",
|
"*.js",
|
||||||
@ -1180,7 +1180,7 @@ exports[`convert-tslint-to-eslint should work for Angular libraries 3`] = `
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"@nx/nx",
|
"@nx",
|
||||||
],
|
],
|
||||||
"root": true,
|
"root": true,
|
||||||
}
|
}
|
||||||
@ -1197,7 +1197,7 @@ exports[`convert-tslint-to-eslint should work for Angular libraries 4`] = `
|
|||||||
"overrides": [
|
"overrides": [
|
||||||
{
|
{
|
||||||
"extends": [
|
"extends": [
|
||||||
"plugin:@nx/nx/angular",
|
"plugin:@nx/angular",
|
||||||
"plugin:@angular-eslint/template/process-inline-templates",
|
"plugin:@angular-eslint/template/process-inline-templates",
|
||||||
],
|
],
|
||||||
"files": [
|
"files": [
|
||||||
@ -1229,7 +1229,7 @@ exports[`convert-tslint-to-eslint should work for Angular libraries 4`] = `
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"extends": [
|
"extends": [
|
||||||
"plugin:@nx/nx/angular-template",
|
"plugin:@nx/angular-template",
|
||||||
],
|
],
|
||||||
"files": [
|
"files": [
|
||||||
"*.html",
|
"*.html",
|
||||||
|
|||||||
@ -321,7 +321,7 @@ describe('convert-tslint-to-eslint', () => {
|
|||||||
* We will make a change to the eslint config before the next step
|
* We will make a change to the eslint config before the next step
|
||||||
*/
|
*/
|
||||||
eslintContent.overrides[0].rules[
|
eslintContent.overrides[0].rules[
|
||||||
'@nx/nx/enforce-module-boundaries'
|
'@nx/enforce-module-boundaries'
|
||||||
][1].enforceBuildableLibDependency = false;
|
][1].enforceBuildableLibDependency = false;
|
||||||
writeJson(host, '.eslintrc.json', eslintContent);
|
writeJson(host, '.eslintrc.json', eslintContent);
|
||||||
|
|
||||||
|
|||||||
@ -1140,7 +1140,7 @@ describe('lib', () => {
|
|||||||
"overrides": [
|
"overrides": [
|
||||||
{
|
{
|
||||||
"extends": [
|
"extends": [
|
||||||
"plugin:@nx/nx/angular",
|
"plugin:@nx/angular",
|
||||||
"plugin:@angular-eslint/template/process-inline-templates",
|
"plugin:@angular-eslint/template/process-inline-templates",
|
||||||
],
|
],
|
||||||
"files": [
|
"files": [
|
||||||
@ -1167,7 +1167,7 @@ describe('lib', () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"extends": [
|
"extends": [
|
||||||
"plugin:@nx/nx/angular-template",
|
"plugin:@nx/angular-template",
|
||||||
],
|
],
|
||||||
"files": [
|
"files": [
|
||||||
"*.html",
|
"*.html",
|
||||||
|
|||||||
@ -53,7 +53,7 @@ exports[`workspace move to nx layout should create a root eslint config 1`] = `
|
|||||||
"*.jsx",
|
"*.jsx",
|
||||||
],
|
],
|
||||||
"rules": {
|
"rules": {
|
||||||
"@nx/nx/enforce-module-boundaries": [
|
"@nx/enforce-module-boundaries": [
|
||||||
"error",
|
"error",
|
||||||
{
|
{
|
||||||
"allow": [],
|
"allow": [],
|
||||||
@ -72,7 +72,7 @@ exports[`workspace move to nx layout should create a root eslint config 1`] = `
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"@nx/nx",
|
"@nx",
|
||||||
],
|
],
|
||||||
"root": true,
|
"root": true,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -945,7 +945,7 @@ describe('app migrator', () => {
|
|||||||
overrides: [
|
overrides: [
|
||||||
{
|
{
|
||||||
files: ['*.ts', '*.tsx'],
|
files: ['*.ts', '*.tsx'],
|
||||||
extends: ['plugin:@nx/nx/typescript'],
|
extends: ['plugin:@nx/typescript'],
|
||||||
rules: { '@typescript-eslint/await-thenable': 'error' },
|
rules: { '@typescript-eslint/await-thenable': 'error' },
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
@ -784,7 +784,7 @@ describe('lib migrator', () => {
|
|||||||
overrides: [
|
overrides: [
|
||||||
{
|
{
|
||||||
files: ['*.ts', '*.tsx'],
|
files: ['*.ts', '*.tsx'],
|
||||||
extends: ['plugin:@nx/nx/typescript'],
|
extends: ['plugin:@nx/typescript'],
|
||||||
rules: { '@typescript-eslint/await-thenable': 'error' },
|
rules: { '@typescript-eslint/await-thenable': 'error' },
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
@ -214,7 +214,7 @@ export function updateRootEsLintConfig(
|
|||||||
existingEsLintConfig.ignorePatterns = ['**/*'];
|
existingEsLintConfig.ignorePatterns = ['**/*'];
|
||||||
if (!(existingEsLintConfig.plugins ?? []).includes('@nrwl/nx')) {
|
if (!(existingEsLintConfig.plugins ?? []).includes('@nrwl/nx')) {
|
||||||
existingEsLintConfig.plugins = Array.from(
|
existingEsLintConfig.plugins = Array.from(
|
||||||
new Set([...(existingEsLintConfig.plugins ?? []), '@nx/nx'])
|
new Set([...(existingEsLintConfig.plugins ?? []), '@nx'])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
existingEsLintConfig.overrides?.forEach((override) => {
|
existingEsLintConfig.overrides?.forEach((override) => {
|
||||||
@ -224,13 +224,13 @@ export function updateRootEsLintConfig(
|
|||||||
|
|
||||||
delete override.parserOptions.project;
|
delete override.parserOptions.project;
|
||||||
});
|
});
|
||||||
// add the @nx/nx/enforce-module-boundaries rule
|
// add the @nx/enforce-module-boundaries rule
|
||||||
existingEsLintConfig.overrides = [
|
existingEsLintConfig.overrides = [
|
||||||
...(existingEsLintConfig.overrides ?? []),
|
...(existingEsLintConfig.overrides ?? []),
|
||||||
{
|
{
|
||||||
files: ['*.ts', '*.tsx', '*.js', '*.jsx'],
|
files: ['*.ts', '*.tsx', '*.js', '*.jsx'],
|
||||||
rules: {
|
rules: {
|
||||||
'@nx/nx/enforce-module-boundaries': [
|
'@nx/enforce-module-boundaries': [
|
||||||
'error',
|
'error',
|
||||||
{
|
{
|
||||||
enforceBuildableLibDependency: true,
|
enforceBuildableLibDependency: true,
|
||||||
|
|||||||
@ -4,7 +4,7 @@ exports[`convert-tslint-to-eslint should work for Cypress applications 1`] = `
|
|||||||
{
|
{
|
||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@nx/eslint-plugin-nx": "0.0.1",
|
"@nx/eslint-plugin": "0.0.1",
|
||||||
"@nx/linter": "0.0.1",
|
"@nx/linter": "0.0.1",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.58.0",
|
"@typescript-eslint/eslint-plugin": "^5.58.0",
|
||||||
"@typescript-eslint/parser": "^5.58.0",
|
"@typescript-eslint/parser": "^5.58.0",
|
||||||
@ -53,7 +53,7 @@ exports[`convert-tslint-to-eslint should work for Cypress applications 3`] = `
|
|||||||
"*.jsx",
|
"*.jsx",
|
||||||
],
|
],
|
||||||
"rules": {
|
"rules": {
|
||||||
"@nx/nx/enforce-module-boundaries": [
|
"@nx/enforce-module-boundaries": [
|
||||||
"error",
|
"error",
|
||||||
{
|
{
|
||||||
"allow": [
|
"allow": [
|
||||||
@ -131,7 +131,7 @@ exports[`convert-tslint-to-eslint should work for Cypress applications 3`] = `
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"extends": [
|
"extends": [
|
||||||
"plugin:@nx/nx/typescript",
|
"plugin:@nx/typescript",
|
||||||
],
|
],
|
||||||
"files": [
|
"files": [
|
||||||
"*.ts",
|
"*.ts",
|
||||||
@ -141,7 +141,7 @@ exports[`convert-tslint-to-eslint should work for Cypress applications 3`] = `
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"extends": [
|
"extends": [
|
||||||
"plugin:@nx/nx/javascript",
|
"plugin:@nx/javascript",
|
||||||
],
|
],
|
||||||
"files": [
|
"files": [
|
||||||
"*.js",
|
"*.js",
|
||||||
@ -238,7 +238,7 @@ exports[`convert-tslint-to-eslint should work for Cypress applications 3`] = `
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"@nx/nx",
|
"@nx",
|
||||||
],
|
],
|
||||||
"root": true,
|
"root": true,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,7 +12,7 @@ exports[`Cypress e2e configuration v10+ should not override eslint settings if p
|
|||||||
"overrides": [
|
"overrides": [
|
||||||
{
|
{
|
||||||
"extends": [
|
"extends": [
|
||||||
"plugin:@nx/nx/angular",
|
"plugin:@nx/angular",
|
||||||
"plugin:@angular-eslint/template/process-inline-templates",
|
"plugin:@angular-eslint/template/process-inline-templates",
|
||||||
],
|
],
|
||||||
"files": [
|
"files": [
|
||||||
@ -39,7 +39,7 @@ exports[`Cypress e2e configuration v10+ should not override eslint settings if p
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"extends": [
|
"extends": [
|
||||||
"plugin:@nx/nx/angular-template",
|
"plugin:@nx/angular-template",
|
||||||
],
|
],
|
||||||
"files": [
|
"files": [
|
||||||
"*.html",
|
"*.html",
|
||||||
|
|||||||
@ -248,13 +248,13 @@ describe('Cypress e2e configuration', () => {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
extends: [
|
extends: [
|
||||||
'plugin:@nx/nx/angular',
|
'plugin:@nx/angular',
|
||||||
'plugin:@angular-eslint/template/process-inline-templates',
|
'plugin:@angular-eslint/template/process-inline-templates',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
files: ['*.html'],
|
files: ['*.html'],
|
||||||
extends: ['plugin:@nx/nx/angular-template'],
|
extends: ['plugin:@nx/angular-template'],
|
||||||
rules: {},
|
rules: {},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
@ -78,7 +78,7 @@ export async function addLinterToCyProject(
|
|||||||
joinPathFragments(projectConfig.root, '.eslintrc.json'),
|
joinPathFragments(projectConfig.root, '.eslintrc.json'),
|
||||||
(json) => {
|
(json) => {
|
||||||
if (options.rootProject) {
|
if (options.rootProject) {
|
||||||
json.plugins = ['@nx/nx'];
|
json.plugins = ['@nx'];
|
||||||
json.extends = ['plugin:cypress/recommended'];
|
json.extends = ['plugin:cypress/recommended'];
|
||||||
} else {
|
} else {
|
||||||
json.extends = ['plugin:cypress/recommended', ...json.extends];
|
json.extends = ['plugin:cypress/recommended', ...json.extends];
|
||||||
|
|||||||
@ -1,14 +0,0 @@
|
|||||||
import { Tree, formatFiles } from '@nx/devkit';
|
|
||||||
import { replaceNrwlPackageWithNxPackage } from '@nx/devkit/src/utils/replace-package';
|
|
||||||
|
|
||||||
export default async function replacePackage(tree: Tree): Promise<void> {
|
|
||||||
await replaceNrwlPackageWithNxPackage(
|
|
||||||
tree,
|
|
||||||
'@nrwl/eslint-plugin-nx',
|
|
||||||
'@nx/eslint-plugin-nx'
|
|
||||||
);
|
|
||||||
|
|
||||||
await replaceNrwlPackageWithNxPackage(tree, '@nrwl/nx', '@nx/nx');
|
|
||||||
|
|
||||||
await formatFiles(tree);
|
|
||||||
}
|
|
||||||
@ -5,7 +5,7 @@ export default {
|
|||||||
},
|
},
|
||||||
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'html'],
|
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'html'],
|
||||||
globals: {},
|
globals: {},
|
||||||
displayName: 'eslint-plugin-nx',
|
displayName: 'packages-eslint-plugin',
|
||||||
testEnvironment: 'node',
|
testEnvironment: 'node',
|
||||||
preset: '../../jest.preset.js',
|
preset: '../../jest.preset.js',
|
||||||
};
|
};
|
||||||
@ -3,7 +3,7 @@
|
|||||||
"update-16-0-0-add-nx-packages": {
|
"update-16-0-0-add-nx-packages": {
|
||||||
"cli": "nx",
|
"cli": "nx",
|
||||||
"version": "16.0.0-beta.1",
|
"version": "16.0.0-beta.1",
|
||||||
"description": "Replace @nrwl/eslint-plugin-nx with @nx/eslint-plugin-nx",
|
"description": "Replace @nrwl/eslint-plugin-nx with @nx/eslint-plugin",
|
||||||
"implementation": "./src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages"
|
"implementation": "./src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@nx/eslint-plugin-nx",
|
"name": "@nx/eslint-plugin",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "The eslint-plugin-nx package is an ESLint plugin that contains a collection of recommended ESLint rule configurations which you can extend from in your own ESLint configs, as well as an Nx-specific lint rule called enforce-module-boundaries.",
|
"description": "The eslint-plugin package is an ESLint plugin that contains a collection of recommended ESLint rule configurations which you can extend from in your own ESLint configs, as well as an Nx-specific lint rule called enforce-module-boundaries.",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/nrwl/nx.git",
|
"url": "https://github.com/nrwl/nx.git",
|
||||||
"directory": "packages/eslint-plugin-nx"
|
"directory": "packages/eslint-plugin"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"Monorepo",
|
"Monorepo",
|
||||||
@ -1,39 +1,39 @@
|
|||||||
{
|
{
|
||||||
"name": "eslint-plugin-nx",
|
"name": "eslint-plugin",
|
||||||
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
||||||
"sourceRoot": "packages/eslint-plugin-nx",
|
"sourceRoot": "packages/eslint-plugin",
|
||||||
"projectType": "library",
|
"projectType": "library",
|
||||||
"targets": {
|
"targets": {
|
||||||
"test": {},
|
"test": {},
|
||||||
"build-base": {
|
"build-base": {
|
||||||
"executor": "@nrwl/js:tsc",
|
"executor": "@nrwl/js:tsc",
|
||||||
"options": {
|
"options": {
|
||||||
"main": "packages/eslint-plugin-nx/src/index.ts",
|
"main": "packages/eslint-plugin/src/index.ts",
|
||||||
"assets": [
|
"assets": [
|
||||||
{
|
{
|
||||||
"input": "packages/eslint-plugin-nx",
|
"input": "packages/eslint-plugin",
|
||||||
"glob": "**/files/**",
|
"glob": "**/files/**",
|
||||||
"output": "/"
|
"output": "/"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"input": "packages/eslint-plugin-nx",
|
"input": "packages/eslint-plugin",
|
||||||
"glob": "**/files/**/.gitkeep",
|
"glob": "**/files/**/.gitkeep",
|
||||||
"output": "/"
|
"output": "/"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"input": "packages/eslint-plugin-nx",
|
"input": "packages/eslint-plugin",
|
||||||
"glob": "**/*.json",
|
"glob": "**/*.json",
|
||||||
"ignore": ["**/tsconfig*.json", "project.json", ".eslintrc.json"],
|
"ignore": ["**/tsconfig*.json", "project.json", ".eslintrc.json"],
|
||||||
"output": "/"
|
"output": "/"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"input": "packages/eslint-plugin-nx",
|
"input": "packages/eslint-plugin",
|
||||||
"glob": "**/*.js",
|
"glob": "**/*.js",
|
||||||
"ignore": ["**/jest.config.js"],
|
"ignore": ["**/jest.config.js"],
|
||||||
"output": "/"
|
"output": "/"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"input": "packages/eslint-plugin-nx",
|
"input": "packages/eslint-plugin",
|
||||||
"glob": "**/*.d.ts",
|
"glob": "**/*.d.ts",
|
||||||
"output": "/"
|
"output": "/"
|
||||||
},
|
},
|
||||||
@ -47,11 +47,11 @@
|
|||||||
},
|
},
|
||||||
"build": {
|
"build": {
|
||||||
"executor": "nx:run-commands",
|
"executor": "nx:run-commands",
|
||||||
"outputs": ["{workspaceRoot}/build/packages/eslint-plugin-nx"],
|
"outputs": ["{workspaceRoot}/build/packages/eslint-plugin"],
|
||||||
"options": {
|
"options": {
|
||||||
"commands": [
|
"commands": [
|
||||||
"node ./scripts/copy-readme.js eslint-plugin-nx",
|
"node ./scripts/copy-readme.js eslint-plugin",
|
||||||
"node ./scripts/add-dependency-to-build.js eslint-plugin-nx @nrwl/eslint-plugin-nx"
|
"node ./scripts/add-dependency-to-build.js eslint-plugin @nrwl/eslint-plugin-nx"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -8,8 +8,8 @@
|
|||||||
*/
|
*/
|
||||||
export default {
|
export default {
|
||||||
extends: [
|
extends: [
|
||||||
'plugin:@nx/nx/react-base',
|
'plugin:@nx/react-base',
|
||||||
'plugin:@nx/nx/react-typescript',
|
'plugin:@nx/react-typescript',
|
||||||
'plugin:@nx/nx/react-jsx',
|
'plugin:@nx/react-jsx',
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
@ -6,11 +6,11 @@ export const WORKSPACE_PLUGIN_DIR = join(workspaceRoot, 'tools/eslint-rules');
|
|||||||
/**
|
/**
|
||||||
* We add a namespace so that we mitigate the risk of rule name collisions as much as
|
* We add a namespace so that we mitigate the risk of rule name collisions as much as
|
||||||
* possible between what users might create in their workspaces and what we might want
|
* possible between what users might create in their workspaces and what we might want
|
||||||
* to offer directly in eslint-plugin-nx in the future.
|
* to offer directly in @nx/eslint-plugin in the future.
|
||||||
*
|
*
|
||||||
* E.g. if a user writes a rule called "foo", then they will include it in their ESLint
|
* E.g. if a user writes a rule called "foo", then they will include it in their ESLint
|
||||||
* config files as:
|
* config files as:
|
||||||
*
|
*
|
||||||
* "@nx/nx/workspace/foo": "error"
|
* "@nx/workspace/foo": "error"
|
||||||
*/
|
*/
|
||||||
export const WORKSPACE_RULE_NAMESPACE = 'workspace';
|
export const WORKSPACE_RULE_NAMESPACE = 'workspace';
|
||||||
@ -24,13 +24,13 @@ describe('update-16-0-0-add-nx-packages', () => {
|
|||||||
).not.toBeDefined();
|
).not.toBeDefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should add a dependency on @nx/eslint-plugin-nx', async () => {
|
it('should add a dependency on @nx/eslint-plugin', async () => {
|
||||||
await replacePackage(tree);
|
await replacePackage(tree);
|
||||||
|
|
||||||
const packageJson = readJson(tree, 'package.json');
|
const packageJson = readJson(tree, 'package.json');
|
||||||
const newDependencyVersion =
|
const newDependencyVersion =
|
||||||
packageJson.devDependencies['@nx/eslint-plugin-nx'] ??
|
packageJson.devDependencies['@nx/eslint-plugin'] ??
|
||||||
packageJson.dependencies['@nx/eslint-plugin-nx'];
|
packageJson.dependencies['@nx/eslint-plugin'];
|
||||||
|
|
||||||
expect(newDependencyVersion).toBeDefined();
|
expect(newDependencyVersion).toBeDefined();
|
||||||
});
|
});
|
||||||
@ -48,10 +48,10 @@ describe('update-16-0-0-add-nx-packages', () => {
|
|||||||
expect(readJson(tree, '.eslintrc.json')).toMatchInlineSnapshot(`
|
expect(readJson(tree, '.eslintrc.json')).toMatchInlineSnapshot(`
|
||||||
{
|
{
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"@nx/nx",
|
"@nx",
|
||||||
],
|
],
|
||||||
"rules": {
|
"rules": {
|
||||||
"@nx/nx/enforce-module-boundaries": [
|
"@nx/enforce-module-boundaries": [
|
||||||
"error",
|
"error",
|
||||||
{},
|
{},
|
||||||
],
|
],
|
||||||
@ -0,0 +1,38 @@
|
|||||||
|
import { Tree, formatFiles, visitNotIgnoredFiles } from '@nx/devkit';
|
||||||
|
import { replaceNrwlPackageWithNxPackage } from '@nx/devkit/src/utils/replace-package';
|
||||||
|
|
||||||
|
import { basename } from 'path';
|
||||||
|
|
||||||
|
const eslintFileNames = [
|
||||||
|
'.eslintrc',
|
||||||
|
'.eslintrc.js',
|
||||||
|
'.eslintrc.cjs',
|
||||||
|
'.eslintrc.yaml',
|
||||||
|
'.eslintrc.yml',
|
||||||
|
'.eslintrc.json',
|
||||||
|
'eslint.config.js', // new format that requires `ESLINT_USE_FLAT_CONFIG=true`
|
||||||
|
];
|
||||||
|
|
||||||
|
export default async function replacePackage(tree: Tree): Promise<void> {
|
||||||
|
await replaceNrwlPackageWithNxPackage(
|
||||||
|
tree,
|
||||||
|
'@nrwl/eslint-plugin-nx',
|
||||||
|
'@nx/eslint-plugin'
|
||||||
|
);
|
||||||
|
|
||||||
|
visitNotIgnoredFiles(tree, '.', (path) => {
|
||||||
|
if (!eslintFileNames.includes(basename(path))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const contents = tree.read(path).toString();
|
||||||
|
|
||||||
|
if (!contents.includes('@nrwl/nx')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
tree.write(path, contents.replace(new RegExp('@nrwl/nx', 'g'), '@nx'));
|
||||||
|
});
|
||||||
|
|
||||||
|
await formatFiles(tree);
|
||||||
|
}
|
||||||
@ -31,7 +31,7 @@ export function ensureGlobalProjectGraph(ruleName: string) {
|
|||||||
);
|
);
|
||||||
} catch {
|
} catch {
|
||||||
const WARNING_PREFIX = `${chalk.reset.keyword('orange')('warning')}`;
|
const WARNING_PREFIX = `${chalk.reset.keyword('orange')('warning')}`;
|
||||||
const RULE_NAME_SUFFIX = `${chalk.reset.dim(`@nx/nx/${ruleName}`)}`;
|
const RULE_NAME_SUFFIX = `${chalk.reset.dim(`@nx/${ruleName}`)}`;
|
||||||
process.stdout
|
process.stdout
|
||||||
.write(`${WARNING_PREFIX} No cached ProjectGraph is available. The rule will be skipped.
|
.write(`${WARNING_PREFIX} No cached ProjectGraph is available. The rule will be skipped.
|
||||||
If you encounter this error as part of running standard \`nx\` commands then please open an issue on https://github.com/nrwl/nx
|
If you encounter this error as part of running standard \`nx\` commands then please open an issue on https://github.com/nrwl/nx
|
||||||
@ -423,7 +423,7 @@ describe('lib', () => {
|
|||||||
const packageJson = readJson(tree, 'package.json');
|
const packageJson = readJson(tree, 'package.json');
|
||||||
expect(packageJson.devDependencies['eslint']).toBeDefined();
|
expect(packageJson.devDependencies['eslint']).toBeDefined();
|
||||||
expect(packageJson.devDependencies['@nx/linter']).toBeDefined();
|
expect(packageJson.devDependencies['@nx/linter']).toBeDefined();
|
||||||
expect(packageJson.devDependencies['@nx/eslint-plugin-nx']).toBeDefined();
|
expect(packageJson.devDependencies['@nx/eslint-plugin']).toBeDefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('not nested', () => {
|
describe('not nested', () => {
|
||||||
|
|||||||
@ -56,5 +56,5 @@
|
|||||||
},
|
},
|
||||||
"lint": {}
|
"lint": {}
|
||||||
},
|
},
|
||||||
"implicitDependencies": ["eslint-plugin-nx"]
|
"implicitDependencies": ["eslint-plugin"]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,7 +7,7 @@ exports[`@nx/linter:init --linter eslint should generate the global eslint confi
|
|||||||
"**/*"
|
"**/*"
|
||||||
],
|
],
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"@nx/nx"
|
"@nx"
|
||||||
],
|
],
|
||||||
"overrides": [
|
"overrides": [
|
||||||
{
|
{
|
||||||
@ -18,7 +18,7 @@ exports[`@nx/linter:init --linter eslint should generate the global eslint confi
|
|||||||
"*.jsx"
|
"*.jsx"
|
||||||
],
|
],
|
||||||
"rules": {
|
"rules": {
|
||||||
"@nx/nx/enforce-module-boundaries": [
|
"@nx/enforce-module-boundaries": [
|
||||||
"error",
|
"error",
|
||||||
{
|
{
|
||||||
"enforceBuildableLibDependency": true,
|
"enforceBuildableLibDependency": true,
|
||||||
@ -41,7 +41,7 @@ exports[`@nx/linter:init --linter eslint should generate the global eslint confi
|
|||||||
"*.tsx"
|
"*.tsx"
|
||||||
],
|
],
|
||||||
"extends": [
|
"extends": [
|
||||||
"plugin:@nx/nx/typescript"
|
"plugin:@nx/typescript"
|
||||||
],
|
],
|
||||||
"rules": {}
|
"rules": {}
|
||||||
},
|
},
|
||||||
@ -51,7 +51,7 @@ exports[`@nx/linter:init --linter eslint should generate the global eslint confi
|
|||||||
"*.jsx"
|
"*.jsx"
|
||||||
],
|
],
|
||||||
"extends": [
|
"extends": [
|
||||||
"plugin:@nx/nx/javascript"
|
"plugin:@nx/javascript"
|
||||||
],
|
],
|
||||||
"rules": {}
|
"rules": {}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,11 +2,11 @@ import { ESLint, Linter as LinterType } from 'eslint';
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This configuration is intended to apply to all TypeScript source files.
|
* This configuration is intended to apply to all TypeScript source files.
|
||||||
* See the eslint-plugin-nx package for what is in the referenced shareable config.
|
* See the eslint-plugin package for what is in the referenced shareable config.
|
||||||
*/
|
*/
|
||||||
export const globalTypeScriptOverrides = {
|
export const globalTypeScriptOverrides = {
|
||||||
files: ['*.ts', '*.tsx'],
|
files: ['*.ts', '*.tsx'],
|
||||||
extends: ['plugin:@nx/nx/typescript'],
|
extends: ['plugin:@nx/typescript'],
|
||||||
/**
|
/**
|
||||||
* Having an empty rules object present makes it more obvious to the user where they would
|
* Having an empty rules object present makes it more obvious to the user where they would
|
||||||
* extend things from if they needed to
|
* extend things from if they needed to
|
||||||
@ -16,11 +16,11 @@ export const globalTypeScriptOverrides = {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This configuration is intended to apply to all JavaScript source files.
|
* This configuration is intended to apply to all JavaScript source files.
|
||||||
* See the eslint-plugin-nx package for what is in the referenced shareable config.
|
* See the eslint-plugin package for what is in the referenced shareable config.
|
||||||
*/
|
*/
|
||||||
export const globalJavaScriptOverrides = {
|
export const globalJavaScriptOverrides = {
|
||||||
files: ['*.js', '*.jsx'],
|
files: ['*.js', '*.jsx'],
|
||||||
extends: ['plugin:@nx/nx/javascript'],
|
extends: ['plugin:@nx/javascript'],
|
||||||
/**
|
/**
|
||||||
* Having an empty rules object present makes it more obvious to the user where they would
|
* Having an empty rules object present makes it more obvious to the user where they would
|
||||||
* extend things from if they needed to
|
* extend things from if they needed to
|
||||||
@ -35,7 +35,7 @@ export const globalJavaScriptOverrides = {
|
|||||||
export const moduleBoundariesOverride = {
|
export const moduleBoundariesOverride = {
|
||||||
files: ['*.ts', '*.tsx', '*.js', '*.jsx'],
|
files: ['*.ts', '*.tsx', '*.js', '*.jsx'],
|
||||||
rules: {
|
rules: {
|
||||||
'@nx/nx/enforce-module-boundaries': [
|
'@nx/enforce-module-boundaries': [
|
||||||
'error',
|
'error',
|
||||||
{
|
{
|
||||||
enforceBuildableLibDependency: true,
|
enforceBuildableLibDependency: true,
|
||||||
@ -53,7 +53,7 @@ export const getGlobalEsLintConfiguration = (
|
|||||||
const config: ESLint.ConfigData = {
|
const config: ESLint.ConfigData = {
|
||||||
root: true,
|
root: true,
|
||||||
ignorePatterns: rootProject ? ['!**/*'] : ['**/*'],
|
ignorePatterns: rootProject ? ['!**/*'] : ['**/*'],
|
||||||
plugins: ['@nx/nx'],
|
plugins: ['@nx'],
|
||||||
/**
|
/**
|
||||||
* We leverage ESLint's "overrides" capability so that we can set up a root config which will support
|
* We leverage ESLint's "overrides" capability so that we can set up a root config which will support
|
||||||
* all permutations of Nx workspaces across all frameworks, libraries and tools.
|
* all permutations of Nx workspaces across all frameworks, libraries and tools.
|
||||||
|
|||||||
@ -57,7 +57,7 @@ function migrateEslintFile(projectEslintPath: string, tree: Tree) {
|
|||||||
// remove nrwl/nx plugins
|
// remove nrwl/nx plugins
|
||||||
if (json.plugins) {
|
if (json.plugins) {
|
||||||
json.plugins = json.plugins.filter(
|
json.plugins = json.plugins.filter(
|
||||||
(p) => p !== '@nx/nx' && p !== '@nrwl/nx'
|
(p) => p !== '@nx' && p !== '@nrwl/nx'
|
||||||
);
|
);
|
||||||
if (json.plugins.length === 0) {
|
if (json.plugins.length === 0) {
|
||||||
delete json.plugins;
|
delete json.plugins;
|
||||||
@ -77,9 +77,9 @@ function migrateEslintFile(projectEslintPath: string, tree: Tree) {
|
|||||||
if (override.extends) {
|
if (override.extends) {
|
||||||
override.extends = override.extends.filter(
|
override.extends = override.extends.filter(
|
||||||
(ext) =>
|
(ext) =>
|
||||||
ext !== 'plugin:@nx/nx/typescript' &&
|
ext !== 'plugin:@nx/typescript' &&
|
||||||
ext !== 'plugin:@nrwl/nx/typescript' &&
|
ext !== 'plugin:@nrwl/nx/typescript' &&
|
||||||
ext !== 'plugin:@nx/nx/javascript' &&
|
ext !== 'plugin:@nx/javascript' &&
|
||||||
ext !== 'plugin:@nrwl/nx/javascript'
|
ext !== 'plugin:@nrwl/nx/javascript'
|
||||||
);
|
);
|
||||||
if (override.extends.length === 0) {
|
if (override.extends.length === 0) {
|
||||||
|
|||||||
@ -81,7 +81,7 @@ function initEsLint(tree: Tree, options: LinterInitOptions): GeneratorCallback {
|
|||||||
{},
|
{},
|
||||||
{
|
{
|
||||||
'@nx/linter': nxVersion,
|
'@nx/linter': nxVersion,
|
||||||
'@nx/eslint-plugin-nx': nxVersion,
|
'@nx/eslint-plugin': nxVersion,
|
||||||
'@typescript-eslint/parser': typescriptESLintVersion,
|
'@typescript-eslint/parser': typescriptESLintVersion,
|
||||||
'@typescript-eslint/eslint-plugin': typescriptESLintVersion,
|
'@typescript-eslint/eslint-plugin': typescriptESLintVersion,
|
||||||
eslint: eslintVersion,
|
eslint: eslintVersion,
|
||||||
|
|||||||
@ -19,7 +19,7 @@ exports[`@nx/linter:workspace-rule --dir should support creating the rule in a n
|
|||||||
|
|
||||||
import { ESLintUtils } from '@typescript-eslint/utils';
|
import { ESLintUtils } from '@typescript-eslint/utils';
|
||||||
|
|
||||||
// NOTE: The rule will be available in ESLint configs as "@nx/nx/workspace/another-rule"
|
// NOTE: The rule will be available in ESLint configs as "@nx/workspace/another-rule"
|
||||||
export const RULE_NAME = 'another-rule';
|
export const RULE_NAME = 'another-rule';
|
||||||
|
|
||||||
export const rule = ESLintUtils.RuleCreator(() => __filename)({
|
export const rule = ESLintUtils.RuleCreator(() => __filename)({
|
||||||
@ -75,7 +75,7 @@ exports[`@nx/linter:workspace-rule --dir should support creating the rule in a n
|
|||||||
|
|
||||||
import { ESLintUtils } from '@typescript-eslint/utils';
|
import { ESLintUtils } from '@typescript-eslint/utils';
|
||||||
|
|
||||||
// NOTE: The rule will be available in ESLint configs as "@nx/nx/workspace/one-more-rule"
|
// NOTE: The rule will be available in ESLint configs as "@nx/workspace/one-more-rule"
|
||||||
export const RULE_NAME = 'one-more-rule';
|
export const RULE_NAME = 'one-more-rule';
|
||||||
|
|
||||||
export const rule = ESLintUtils.RuleCreator(() => __filename)({
|
export const rule = ESLintUtils.RuleCreator(() => __filename)({
|
||||||
@ -131,7 +131,7 @@ exports[`@nx/linter:workspace-rule should generate the required files 1`] = `
|
|||||||
|
|
||||||
import { ESLintUtils } from '@typescript-eslint/utils';
|
import { ESLintUtils } from '@typescript-eslint/utils';
|
||||||
|
|
||||||
// NOTE: The rule will be available in ESLint configs as "@nx/nx/workspace/my-rule"
|
// NOTE: The rule will be available in ESLint configs as "@nx/workspace/my-rule"
|
||||||
export const RULE_NAME = 'my-rule';
|
export const RULE_NAME = 'my-rule';
|
||||||
|
|
||||||
export const rule = ESLintUtils.RuleCreator(() => __filename)({
|
export const rule = ESLintUtils.RuleCreator(() => __filename)({
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
import { ESLintUtils } from '@typescript-eslint/utils';
|
import { ESLintUtils } from '@typescript-eslint/utils';
|
||||||
|
|
||||||
// NOTE: The rule will be available in ESLint configs as "@nx/nx/workspace/<%= name %>"
|
// NOTE: The rule will be available in ESLint configs as "@nx/workspace/<%= name %>"
|
||||||
export const RULE_NAME = '<%= name %>';
|
export const RULE_NAME = '<%= name %>';
|
||||||
|
|
||||||
export const rule = ESLintUtils.RuleCreator(() => __filename)({
|
export const rule = ESLintUtils.RuleCreator(() => __filename)({
|
||||||
|
|||||||
@ -109,7 +109,7 @@ export async function lintWorkspaceRuleGenerator(
|
|||||||
logger.info(`NX Reminder: Once you have finished writing your rule logic, you need to actually enable the rule within an appropriate .eslintrc.json in your workspace, for example:
|
logger.info(`NX Reminder: Once you have finished writing your rule logic, you need to actually enable the rule within an appropriate .eslintrc.json in your workspace, for example:
|
||||||
|
|
||||||
"rules": {
|
"rules": {
|
||||||
"@nx/nx/workspace/${options.name}": "error"
|
"@nx/workspace/${options.name}": "error"
|
||||||
}
|
}
|
||||||
`);
|
`);
|
||||||
|
|
||||||
|
|||||||
@ -63,7 +63,7 @@ describe('convertTslintNxRuleToEslintNxRule()', () => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
expected: {
|
expected: {
|
||||||
ruleName: '@nx/nx/enforce-module-boundaries',
|
ruleName: '@nx/enforce-module-boundaries',
|
||||||
ruleConfig: ['error', configFromNxExamplesRepo],
|
ruleConfig: ['error', configFromNxExamplesRepo],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -76,7 +76,7 @@ describe('convertTslintNxRuleToEslintNxRule()', () => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
expected: {
|
expected: {
|
||||||
ruleName: '@nx/nx/enforce-module-boundaries',
|
ruleName: '@nx/enforce-module-boundaries',
|
||||||
ruleConfig: ['off', configFromNxExamplesRepo],
|
ruleConfig: ['off', configFromNxExamplesRepo],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -89,7 +89,7 @@ describe('convertTslintNxRuleToEslintNxRule()', () => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
expected: {
|
expected: {
|
||||||
ruleName: '@nx/nx/enforce-module-boundaries',
|
ruleName: '@nx/enforce-module-boundaries',
|
||||||
ruleConfig: ['warn', configFromNxExamplesRepo],
|
ruleConfig: ['warn', configFromNxExamplesRepo],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -104,7 +104,7 @@ describe('convertTslintNxRuleToEslintNxRule()', () => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
expected: {
|
expected: {
|
||||||
ruleName: '@nx/nx/enforce-module-boundaries',
|
ruleName: '@nx/enforce-module-boundaries',
|
||||||
ruleConfig: ['error', configFromNxExamplesRepo],
|
ruleConfig: ['error', configFromNxExamplesRepo],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -119,7 +119,7 @@ describe('convertTslintNxRuleToEslintNxRule()', () => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
expected: {
|
expected: {
|
||||||
ruleName: '@nx/nx/enforce-module-boundaries',
|
ruleName: '@nx/enforce-module-boundaries',
|
||||||
ruleConfig: ['warn', configFromNxExamplesRepo],
|
ruleConfig: ['warn', configFromNxExamplesRepo],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -134,7 +134,7 @@ describe('convertTslintNxRuleToEslintNxRule()', () => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
expected: {
|
expected: {
|
||||||
ruleName: '@nx/nx/enforce-module-boundaries',
|
ruleName: '@nx/enforce-module-boundaries',
|
||||||
ruleConfig: ['off', configFromNxExamplesRepo],
|
ruleConfig: ['off', configFromNxExamplesRepo],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -150,7 +150,7 @@ describe('convertTslintNxRuleToEslintNxRule()', () => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
expected: {
|
expected: {
|
||||||
ruleName: '@nx/nx/enforce-module-boundaries',
|
ruleName: '@nx/enforce-module-boundaries',
|
||||||
ruleConfig: ['warn', configFromNxExamplesRepo],
|
ruleConfig: ['warn', configFromNxExamplesRepo],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -73,7 +73,7 @@ export function convertTslintNxRuleToEslintNxRule(
|
|||||||
);
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
ruleName: '@nx/nx/enforce-module-boundaries',
|
ruleName: '@nx/enforce-module-boundaries',
|
||||||
ruleConfig: [ruleSeverity, existingRuleConfig],
|
ruleConfig: [ruleSeverity, existingRuleConfig],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -192,9 +192,9 @@ export class ProjectConverter {
|
|||||||
/**
|
/**
|
||||||
* The only piece of the converted root tslint.json that we need to pull out to
|
* The only piece of the converted root tslint.json that we need to pull out to
|
||||||
* apply to the existing overrides within the root .eslintrc.json is the
|
* apply to the existing overrides within the root .eslintrc.json is the
|
||||||
* @nx/nx/enforce-module-boundaries rule.
|
* @nx/enforce-module-boundaries rule.
|
||||||
*/
|
*/
|
||||||
const nxRuleName = '@nx/nx/enforce-module-boundaries';
|
const nxRuleName = '@nx/enforce-module-boundaries';
|
||||||
const nxEnforceModuleBoundariesRule =
|
const nxEnforceModuleBoundariesRule =
|
||||||
convertedRootESLintConfig.rules[nxRuleName];
|
convertedRootESLintConfig.rules[nxRuleName];
|
||||||
if (nxEnforceModuleBoundariesRule) {
|
if (nxEnforceModuleBoundariesRule) {
|
||||||
|
|||||||
@ -4,7 +4,7 @@ exports[`convert-tslint-to-eslint should work for NestJS applications 1`] = `
|
|||||||
{
|
{
|
||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@nx/eslint-plugin-nx": "0.0.1",
|
"@nx/eslint-plugin": "0.0.1",
|
||||||
"@nx/linter": "0.0.1",
|
"@nx/linter": "0.0.1",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.58.0",
|
"@typescript-eslint/eslint-plugin": "^5.58.0",
|
||||||
"@typescript-eslint/parser": "^5.58.0",
|
"@typescript-eslint/parser": "^5.58.0",
|
||||||
@ -52,7 +52,7 @@ exports[`convert-tslint-to-eslint should work for NestJS applications 3`] = `
|
|||||||
"*.jsx",
|
"*.jsx",
|
||||||
],
|
],
|
||||||
"rules": {
|
"rules": {
|
||||||
"@nx/nx/enforce-module-boundaries": [
|
"@nx/enforce-module-boundaries": [
|
||||||
"error",
|
"error",
|
||||||
{
|
{
|
||||||
"allow": [
|
"allow": [
|
||||||
@ -130,7 +130,7 @@ exports[`convert-tslint-to-eslint should work for NestJS applications 3`] = `
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"extends": [
|
"extends": [
|
||||||
"plugin:@nx/nx/typescript",
|
"plugin:@nx/typescript",
|
||||||
],
|
],
|
||||||
"files": [
|
"files": [
|
||||||
"*.ts",
|
"*.ts",
|
||||||
@ -140,7 +140,7 @@ exports[`convert-tslint-to-eslint should work for NestJS applications 3`] = `
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"extends": [
|
"extends": [
|
||||||
"plugin:@nx/nx/javascript",
|
"plugin:@nx/javascript",
|
||||||
],
|
],
|
||||||
"files": [
|
"files": [
|
||||||
"*.js",
|
"*.js",
|
||||||
@ -237,7 +237,7 @@ exports[`convert-tslint-to-eslint should work for NestJS applications 3`] = `
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"@nx/nx",
|
"@nx",
|
||||||
],
|
],
|
||||||
"root": true,
|
"root": true,
|
||||||
}
|
}
|
||||||
@ -289,7 +289,7 @@ exports[`convert-tslint-to-eslint should work for NestJS libraries 1`] = `
|
|||||||
{
|
{
|
||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@nx/eslint-plugin-nx": "0.0.1",
|
"@nx/eslint-plugin": "0.0.1",
|
||||||
"@nx/linter": "0.0.1",
|
"@nx/linter": "0.0.1",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.58.0",
|
"@typescript-eslint/eslint-plugin": "^5.58.0",
|
||||||
"@typescript-eslint/parser": "^5.58.0",
|
"@typescript-eslint/parser": "^5.58.0",
|
||||||
@ -337,7 +337,7 @@ exports[`convert-tslint-to-eslint should work for NestJS libraries 3`] = `
|
|||||||
"*.jsx",
|
"*.jsx",
|
||||||
],
|
],
|
||||||
"rules": {
|
"rules": {
|
||||||
"@nx/nx/enforce-module-boundaries": [
|
"@nx/enforce-module-boundaries": [
|
||||||
"error",
|
"error",
|
||||||
{
|
{
|
||||||
"allow": [
|
"allow": [
|
||||||
@ -415,7 +415,7 @@ exports[`convert-tslint-to-eslint should work for NestJS libraries 3`] = `
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"extends": [
|
"extends": [
|
||||||
"plugin:@nx/nx/typescript",
|
"plugin:@nx/typescript",
|
||||||
],
|
],
|
||||||
"files": [
|
"files": [
|
||||||
"*.ts",
|
"*.ts",
|
||||||
@ -425,7 +425,7 @@ exports[`convert-tslint-to-eslint should work for NestJS libraries 3`] = `
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"extends": [
|
"extends": [
|
||||||
"plugin:@nx/nx/javascript",
|
"plugin:@nx/javascript",
|
||||||
],
|
],
|
||||||
"files": [
|
"files": [
|
||||||
"*.js",
|
"*.js",
|
||||||
@ -522,7 +522,7 @@ exports[`convert-tslint-to-eslint should work for NestJS libraries 3`] = `
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"@nx/nx",
|
"@nx",
|
||||||
],
|
],
|
||||||
"root": true,
|
"root": true,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -339,7 +339,7 @@ describe('app', () => {
|
|||||||
"jest": true,
|
"jest": true,
|
||||||
},
|
},
|
||||||
"extends": [
|
"extends": [
|
||||||
"plugin:@nx/nx/react-typescript",
|
"plugin:@nx/react-typescript",
|
||||||
"next",
|
"next",
|
||||||
"next/core-web-vitals",
|
"next/core-web-vitals",
|
||||||
"../../.eslintrc.json",
|
"../../.eslintrc.json",
|
||||||
|
|||||||
@ -79,10 +79,11 @@ export async function addLinting(
|
|||||||
json.extends.unshift(...['next', 'next/core-web-vitals']);
|
json.extends.unshift(...['next', 'next/core-web-vitals']);
|
||||||
// remove nx/react plugin, as it conflicts with the next.js one
|
// remove nx/react plugin, as it conflicts with the next.js one
|
||||||
json.extends = json.extends.filter(
|
json.extends = json.extends.filter(
|
||||||
(name) => name !== 'plugin:@nx/nx/react'
|
(name) =>
|
||||||
|
name !== 'plugin:@nx/react' && name !== 'plugin:@nrwl/nx/react'
|
||||||
);
|
);
|
||||||
|
|
||||||
json.extends.unshift('plugin:@nx/nx/react-typescript');
|
json.extends.unshift('plugin:@nx/react-typescript');
|
||||||
if (!json.env) {
|
if (!json.env) {
|
||||||
json.env = {};
|
json.env = {};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -113,7 +113,7 @@ export async function e2eProjectGenerator(host: Tree, _options: Schema) {
|
|||||||
|
|
||||||
updateJson(host, join(options.e2eProjectRoot, '.eslintrc.json'), (json) => {
|
updateJson(host, join(options.e2eProjectRoot, '.eslintrc.json'), (json) => {
|
||||||
if (options.rootProject) {
|
if (options.rootProject) {
|
||||||
json.plugins = ['@nx/nx'];
|
json.plugins = ['@nx'];
|
||||||
json.extends = [];
|
json.extends = [];
|
||||||
}
|
}
|
||||||
json.overrides = [
|
json.overrides = [
|
||||||
|
|||||||
@ -76,7 +76,7 @@ describe('lint-checks generator', () => {
|
|||||||
'./generators.json',
|
'./generators.json',
|
||||||
]),
|
]),
|
||||||
rules: {
|
rules: {
|
||||||
'@nx/nx/nx-plugin-checks': 'error',
|
'@nx/nx-plugin-checks': 'error',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
@ -100,7 +100,7 @@ describe('lint-checks generator', () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
eslintConfig.overrides.filter((x) => '@nx/nx/nx-plugin-checks' in x.rules)
|
eslintConfig.overrides.filter((x) => '@nx/nx-plugin-checks' in x.rules)
|
||||||
).toHaveLength(1);
|
).toHaveLength(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -155,7 +155,7 @@ describe('lint-checks generator', () => {
|
|||||||
'./migrations.json',
|
'./migrations.json',
|
||||||
]),
|
]),
|
||||||
rules: {
|
rules: {
|
||||||
'@nx/nx/nx-plugin-checks': 'error',
|
'@nx/nx-plugin-checks': 'error',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|||||||
@ -115,7 +115,7 @@ export function addMigrationJsonChecks(
|
|||||||
(c) => {
|
(c) => {
|
||||||
const override = c.overrides.find(
|
const override = c.overrides.find(
|
||||||
(o) =>
|
(o) =>
|
||||||
Object.keys(o.rules ?? {})?.includes('@nx/nx/nx-plugin-checks') ||
|
Object.keys(o.rules ?? {})?.includes('@nx/nx-plugin-checks') ||
|
||||||
Object.keys(o.rules ?? {})?.includes('@nrwl/nx/nx-plugin-checks')
|
Object.keys(o.rules ?? {})?.includes('@nrwl/nx/nx-plugin-checks')
|
||||||
);
|
);
|
||||||
if (
|
if (
|
||||||
@ -195,7 +195,7 @@ function updateProjectEslintConfig(
|
|||||||
let entry: ESLint.ConfigOverride<ESLint.RulesRecord> =
|
let entry: ESLint.ConfigOverride<ESLint.RulesRecord> =
|
||||||
eslintConfig.overrides.find(
|
eslintConfig.overrides.find(
|
||||||
(x) =>
|
(x) =>
|
||||||
Object.keys(x.rules ?? {}).includes('@nx/nx/nx-plugin-checks') ||
|
Object.keys(x.rules ?? {}).includes('@nx/nx-plugin-checks') ||
|
||||||
Object.keys(x.rules ?? {}).includes('@nrwl/nx/nx-plugin-checks')
|
Object.keys(x.rules ?? {}).includes('@nrwl/nx/nx-plugin-checks')
|
||||||
);
|
);
|
||||||
const newentry = !entry;
|
const newentry = !entry;
|
||||||
@ -214,7 +214,7 @@ function updateProjectEslintConfig(
|
|||||||
];
|
];
|
||||||
entry.parser = 'jsonc-eslint-parser';
|
entry.parser = 'jsonc-eslint-parser';
|
||||||
entry.rules ??= {
|
entry.rules ??= {
|
||||||
'@nx/nx/nx-plugin-checks': 'error',
|
'@nx/nx-plugin-checks': 'error',
|
||||||
};
|
};
|
||||||
|
|
||||||
if (newentry) {
|
if (newentry) {
|
||||||
|
|||||||
@ -110,7 +110,7 @@
|
|||||||
"@nrwl/devkit",
|
"@nrwl/devkit",
|
||||||
"@nx/esbuild",
|
"@nx/esbuild",
|
||||||
"@nrwl/esbuild",
|
"@nrwl/esbuild",
|
||||||
"@nx/eslint-plugin-nx",
|
"@nx/eslint-plugin",
|
||||||
"@nrwl/eslint-plugin-nx",
|
"@nrwl/eslint-plugin-nx",
|
||||||
"@nx/expo",
|
"@nx/expo",
|
||||||
"@nrwl/expo",
|
"@nrwl/expo",
|
||||||
|
|||||||
@ -131,7 +131,7 @@ describe('app', () => {
|
|||||||
|
|
||||||
const eslintJson = readJson(appTree, 'apps/my-app/.eslintrc.json');
|
const eslintJson = readJson(appTree, 'apps/my-app/.eslintrc.json');
|
||||||
expect(eslintJson.extends).toEqual([
|
expect(eslintJson.extends).toEqual([
|
||||||
'plugin:@nx/nx/react',
|
'plugin:@nx/react',
|
||||||
'../../.eslintrc.json',
|
'../../.eslintrc.json',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@ -247,7 +247,7 @@ describe('app', () => {
|
|||||||
{
|
{
|
||||||
path: 'apps/my-dir/my-app/.eslintrc.json',
|
path: 'apps/my-dir/my-app/.eslintrc.json',
|
||||||
lookupFn: (json) => json.extends,
|
lookupFn: (json) => json.extends,
|
||||||
expectedValue: ['plugin:@nx/nx/react', '../../../.eslintrc.json'],
|
expectedValue: ['plugin:@nx/react', '../../../.eslintrc.json'],
|
||||||
},
|
},
|
||||||
].forEach(hasJsonValue);
|
].forEach(hasJsonValue);
|
||||||
});
|
});
|
||||||
@ -515,7 +515,7 @@ describe('app', () => {
|
|||||||
|
|
||||||
expect(packageJson.devDependencies.eslint).toBeDefined();
|
expect(packageJson.devDependencies.eslint).toBeDefined();
|
||||||
expect(packageJson.devDependencies['@nx/linter']).toBeDefined();
|
expect(packageJson.devDependencies['@nx/linter']).toBeDefined();
|
||||||
expect(packageJson.devDependencies['@nx/eslint-plugin-nx']).toBeDefined();
|
expect(packageJson.devDependencies['@nx/eslint-plugin']).toBeDefined();
|
||||||
expect(packageJson.devDependencies['eslint-plugin-react']).toBeDefined();
|
expect(packageJson.devDependencies['eslint-plugin-react']).toBeDefined();
|
||||||
expect(
|
expect(
|
||||||
packageJson.devDependencies['eslint-plugin-react-hooks']
|
packageJson.devDependencies['eslint-plugin-react-hooks']
|
||||||
@ -532,7 +532,7 @@ describe('app', () => {
|
|||||||
expect(eslintJson).toMatchInlineSnapshot(`
|
expect(eslintJson).toMatchInlineSnapshot(`
|
||||||
{
|
{
|
||||||
"extends": [
|
"extends": [
|
||||||
"plugin:@nx/nx/react",
|
"plugin:@nx/react",
|
||||||
"../../.eslintrc.json",
|
"../../.eslintrc.json",
|
||||||
],
|
],
|
||||||
"ignorePatterns": [
|
"ignorePatterns": [
|
||||||
|
|||||||
@ -194,7 +194,7 @@ describe('lib', () => {
|
|||||||
expect(eslintJson).toMatchInlineSnapshot(`
|
expect(eslintJson).toMatchInlineSnapshot(`
|
||||||
{
|
{
|
||||||
"extends": [
|
"extends": [
|
||||||
"plugin:@nx/nx/react",
|
"plugin:@nx/react",
|
||||||
"../../.eslintrc.json",
|
"../../.eslintrc.json",
|
||||||
],
|
],
|
||||||
"ignorePatterns": [
|
"ignorePatterns": [
|
||||||
|
|||||||
@ -21,7 +21,7 @@ export const extendReactEslintJson = (json: Linter.Config) => {
|
|||||||
const { extends: pluginExtends, ...config } = json;
|
const { extends: pluginExtends, ...config } = json;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
extends: ['plugin:@nx/nx/react', ...(pluginExtends || [])],
|
extends: ['plugin:@nx/react', ...(pluginExtends || [])],
|
||||||
...config,
|
...config,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -33,10 +33,7 @@ export const createReactEslintJson = (
|
|||||||
projectRoot: string,
|
projectRoot: string,
|
||||||
setParserOptionsProject: boolean
|
setParserOptionsProject: boolean
|
||||||
): Linter.Config => ({
|
): Linter.Config => ({
|
||||||
extends: [
|
extends: ['plugin:@nx/react', `${offsetFromRoot(projectRoot)}.eslintrc.json`],
|
||||||
'plugin:@nx/nx/react',
|
|
||||||
`${offsetFromRoot(projectRoot)}.eslintrc.json`,
|
|
||||||
],
|
|
||||||
ignorePatterns: ['!**/*'],
|
ignorePatterns: ['!**/*'],
|
||||||
overrides: [
|
overrides: [
|
||||||
{
|
{
|
||||||
|
|||||||
@ -100,7 +100,7 @@ describe('updateEslint', () => {
|
|||||||
});
|
});
|
||||||
updateJson(tree, 'libs/my-lib/.eslintrc.json', (eslintRcJson) => {
|
updateJson(tree, 'libs/my-lib/.eslintrc.json', (eslintRcJson) => {
|
||||||
eslintRcJson.extends = [
|
eslintRcJson.extends = [
|
||||||
'plugin:@nx/nx/react',
|
'plugin:@nx/react',
|
||||||
'../../.eslintrc.json',
|
'../../.eslintrc.json',
|
||||||
'./customrc.json',
|
'./customrc.json',
|
||||||
];
|
];
|
||||||
@ -120,7 +120,7 @@ describe('updateEslint', () => {
|
|||||||
).toEqual(
|
).toEqual(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
extends: [
|
extends: [
|
||||||
'plugin:@nx/nx/react',
|
'plugin:@nx/react',
|
||||||
'../../../.eslintrc.json',
|
'../../../.eslintrc.json',
|
||||||
'./customrc.json',
|
'./customrc.json',
|
||||||
],
|
],
|
||||||
|
|||||||
@ -60,7 +60,7 @@ const IGNORE_MATCHES_IN_PACKAGE = {
|
|||||||
'rxjs',
|
'rxjs',
|
||||||
'webpack',
|
'webpack',
|
||||||
],
|
],
|
||||||
'eslint-plugin-nx': ['@angular-eslint/eslint-plugin'],
|
'eslint-plugin': ['@angular-eslint/eslint-plugin'],
|
||||||
jest: [
|
jest: [
|
||||||
'jest',
|
'jest',
|
||||||
'@jest/types',
|
'@jest/types',
|
||||||
|
|||||||
@ -8,7 +8,7 @@ const IGNORE_MATCHES = {
|
|||||||
cli: [],
|
cli: [],
|
||||||
cypress: [],
|
cypress: [],
|
||||||
devkit: [],
|
devkit: [],
|
||||||
'eslint-plugin-nx': [],
|
'eslint-plugin': [],
|
||||||
jest: [
|
jest: [
|
||||||
// This is used for the type import only, we should remove it.
|
// This is used for the type import only, we should remove it.
|
||||||
'jest-resolve',
|
'jest-resolve',
|
||||||
|
|||||||
@ -130,7 +130,9 @@ export function getPackageMetadataList(
|
|||||||
githubRoot: 'https://github.com/nrwl/nx/blob/master',
|
githubRoot: 'https://github.com/nrwl/nx/blob/master',
|
||||||
name: folderName,
|
name: folderName,
|
||||||
// TODO(v16): Remove this replace
|
// TODO(v16): Remove this replace
|
||||||
packageName: packageJson.name.replace('@nx/', '@nrwl/'),
|
packageName: packageJson.name
|
||||||
|
.replace('@nx/', '@nrwl/')
|
||||||
|
.replace('@nrwl/eslint-plugin', '@nrwl/eslint-plugin-nx'),
|
||||||
description: packageJson.description,
|
description: packageJson.description,
|
||||||
root: relativeFolderPath,
|
root: relativeFolderPath,
|
||||||
source: join(relativeFolderPath, '/src'),
|
source: join(relativeFolderPath, '/src'),
|
||||||
|
|||||||
@ -75,7 +75,7 @@
|
|||||||
"@nx/devkit": ["packages/devkit"],
|
"@nx/devkit": ["packages/devkit"],
|
||||||
"@nx/devkit/*": ["packages/devkit/*"],
|
"@nx/devkit/*": ["packages/devkit/*"],
|
||||||
"@nx/esbuild": ["packages/esbuild"],
|
"@nx/esbuild": ["packages/esbuild"],
|
||||||
"@nx/eslint-plugin-nx": ["packages/eslint-plugin-nx/src"],
|
"@nx/eslint-plugin": ["packages/eslint-plugin/src"],
|
||||||
"@nx/expo": ["packages/expo"],
|
"@nx/expo": ["packages/expo"],
|
||||||
"@nx/expo/*": ["packages/expo/*"],
|
"@nx/expo/*": ["packages/expo/*"],
|
||||||
"@nx/express": ["packages/express"],
|
"@nx/express": ["packages/express"],
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user