@nx/eslint-plugin 19.7.2 → 19.8.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/angular.d.ts +8 -0
- package/angular.js +16 -0
- package/nx.d.ts +25 -0
- package/nx.js +21 -0
- package/package.json +9 -7
- package/react.d.ts +10 -0
- package/react.js +20 -0
- package/src/configs/javascript.d.ts +7 -0
- package/src/configs/javascript.js +7 -0
- package/src/configs/typescript.d.ts +7 -0
- package/src/configs/typescript.js +7 -0
- package/src/flat-configs/angular-template.d.ts +16 -0
- package/src/flat-configs/angular-template.js +27 -0
- package/src/flat-configs/angular.d.ts +13 -0
- package/src/flat-configs/angular.js +28 -0
- package/src/flat-configs/base.d.ts +7 -0
- package/src/flat-configs/base.js +12 -0
- package/src/flat-configs/javascript.d.ts +18 -0
- package/src/flat-configs/javascript.js +75 -0
- package/src/flat-configs/react-base.d.ts +16 -0
- package/src/flat-configs/react-base.js +146 -0
- package/src/flat-configs/react-jsx.d.ts +12 -0
- package/src/flat-configs/react-jsx.js +76 -0
- package/src/flat-configs/react-tmp.d.ts +10 -0
- package/src/flat-configs/react-tmp.js +16 -0
- package/src/flat-configs/react-typescript.d.ts +12 -0
- package/src/flat-configs/react-typescript.js +56 -0
- package/src/flat-configs/typescript.d.ts +9 -0
- package/src/flat-configs/typescript.js +59 -0
- package/src/index.js +29 -0
- package/src/rules/dependency-checks.d.ts +1 -1
- package/src/rules/dependency-checks.js +0 -1
- package/src/rules/enforce-module-boundaries.d.ts +1 -1
- package/src/rules/enforce-module-boundaries.js +0 -1
- package/src/rules/nx-plugin-checks.d.ts +1 -1
- package/src/rules/nx-plugin-checks.js +0 -1
- package/typescript.d.ts +8 -0
- package/typescript.js +16 -0
package/angular.d.ts
ADDED
package/angular.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const angular_1 = tslib_1.__importDefault(require("./src/flat-configs/angular"));
|
|
5
|
+
const angular_template_1 = tslib_1.__importDefault(require("./src/flat-configs/angular-template"));
|
|
6
|
+
const plugin = {
|
|
7
|
+
configs: {
|
|
8
|
+
angular: angular_1.default,
|
|
9
|
+
'angular-template': angular_template_1.default,
|
|
10
|
+
},
|
|
11
|
+
rules: {},
|
|
12
|
+
};
|
|
13
|
+
// ESM
|
|
14
|
+
exports.default = plugin;
|
|
15
|
+
// CommonJS
|
|
16
|
+
module.exports = plugin;
|
package/nx.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
declare const plugin: {
|
|
2
|
+
configs: {};
|
|
3
|
+
rules: {
|
|
4
|
+
"enforce-module-boundaries": import("@typescript-eslint/utils/ts-eslint").RuleModule<import("./src/rules/enforce-module-boundaries").MessageIds, [{
|
|
5
|
+
allow: string[];
|
|
6
|
+
buildTargets: string[];
|
|
7
|
+
depConstraints: import("./src/utils/runtime-lint-utils").DepConstraint[];
|
|
8
|
+
enforceBuildableLibDependency: boolean;
|
|
9
|
+
allowCircularSelfDependency: boolean;
|
|
10
|
+
ignoredCircularDependencies: Array<[string, string]>;
|
|
11
|
+
checkDynamicDependenciesExceptions: string[];
|
|
12
|
+
banTransitiveDependencies: boolean;
|
|
13
|
+
checkNestedExternalImports: boolean;
|
|
14
|
+
}], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
15
|
+
"nx-plugin-checks": import("@typescript-eslint/utils/ts-eslint").RuleModule<import("./src/rules/nx-plugin-checks").MessageIds, [{
|
|
16
|
+
generatorsJson?: string;
|
|
17
|
+
executorsJson?: string;
|
|
18
|
+
migrationsJson?: string;
|
|
19
|
+
packageJson?: string;
|
|
20
|
+
allowedVersionStrings: string[];
|
|
21
|
+
}], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
22
|
+
"dependency-checks": import("@typescript-eslint/utils/ts-eslint").RuleModule<import("./src/rules/dependency-checks").MessageIds, import("./src/rules/dependency-checks").Options, unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export default plugin;
|
package/nx.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const resolve_workspace_rules_1 = require("./src/resolve-workspace-rules");
|
|
5
|
+
const dependency_checks_1 = tslib_1.__importStar(require("./src/rules/dependency-checks"));
|
|
6
|
+
const enforce_module_boundaries_1 = tslib_1.__importStar(require("./src/rules/enforce-module-boundaries"));
|
|
7
|
+
const nx_plugin_checks_1 = tslib_1.__importStar(require("./src/rules/nx-plugin-checks"));
|
|
8
|
+
const plugin = {
|
|
9
|
+
configs: {},
|
|
10
|
+
rules: {
|
|
11
|
+
[enforce_module_boundaries_1.RULE_NAME]: enforce_module_boundaries_1.default,
|
|
12
|
+
[nx_plugin_checks_1.RULE_NAME]: nx_plugin_checks_1.default,
|
|
13
|
+
[dependency_checks_1.RULE_NAME]: dependency_checks_1.default,
|
|
14
|
+
// Resolve any custom rules that might exist in the current workspace
|
|
15
|
+
...resolve_workspace_rules_1.workspaceRules,
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
// ESM
|
|
19
|
+
exports.default = plugin;
|
|
20
|
+
// CommonJS
|
|
21
|
+
module.exports = plugin;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/eslint-plugin",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.8.0-beta.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"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.",
|
|
6
6
|
"repository": {
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"homepage": "https://nx.dev",
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@typescript-eslint/parser": "^6.13.2 || ^7.0.0",
|
|
28
|
+
"@typescript-eslint/parser": "^6.13.2 || ^7.0.0 || ^8.0.0",
|
|
29
29
|
"eslint-config-prettier": "^9.0.0"
|
|
30
30
|
},
|
|
31
31
|
"peerDependenciesMeta": {
|
|
@@ -34,16 +34,18 @@
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@
|
|
38
|
-
"@nx/
|
|
39
|
-
"@
|
|
40
|
-
"@typescript-eslint/utils": "^
|
|
37
|
+
"@eslint/compat": "^1.1.1",
|
|
38
|
+
"@nx/devkit": "19.8.0-beta.0",
|
|
39
|
+
"@nx/js": "19.8.0-beta.0",
|
|
40
|
+
"@typescript-eslint/type-utils": "^8.0.0",
|
|
41
|
+
"@typescript-eslint/utils": "^8.0.0",
|
|
41
42
|
"chalk": "^4.1.0",
|
|
42
43
|
"confusing-browser-globals": "^1.0.9",
|
|
44
|
+
"globals": "^15.9.0",
|
|
43
45
|
"jsonc-eslint-parser": "^2.1.0",
|
|
44
46
|
"semver": "^7.5.3",
|
|
45
47
|
"tslib": "^2.3.0",
|
|
46
|
-
"@nrwl/eslint-plugin-nx": "19.
|
|
48
|
+
"@nrwl/eslint-plugin-nx": "19.8.0-beta.0"
|
|
47
49
|
},
|
|
48
50
|
"publishConfig": {
|
|
49
51
|
"access": "public"
|
package/react.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare const plugin: {
|
|
2
|
+
configs: {
|
|
3
|
+
react: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
4
|
+
'react-base': import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
5
|
+
'react-typescript': import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
6
|
+
'react-jsx': import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
7
|
+
};
|
|
8
|
+
rules: {};
|
|
9
|
+
};
|
|
10
|
+
export default plugin;
|
package/react.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const react_base_1 = tslib_1.__importDefault(require("./src/flat-configs/react-base"));
|
|
5
|
+
const react_jsx_1 = tslib_1.__importDefault(require("./src/flat-configs/react-jsx"));
|
|
6
|
+
const react_tmp_1 = tslib_1.__importDefault(require("./src/flat-configs/react-tmp"));
|
|
7
|
+
const react_typescript_1 = tslib_1.__importDefault(require("./src/flat-configs/react-typescript"));
|
|
8
|
+
const plugin = {
|
|
9
|
+
configs: {
|
|
10
|
+
react: react_tmp_1.default,
|
|
11
|
+
'react-base': react_base_1.default,
|
|
12
|
+
'react-typescript': react_typescript_1.default,
|
|
13
|
+
'react-jsx': react_jsx_1.default,
|
|
14
|
+
},
|
|
15
|
+
rules: {},
|
|
16
|
+
};
|
|
17
|
+
// ESM
|
|
18
|
+
exports.default = plugin;
|
|
19
|
+
// CommonJS
|
|
20
|
+
module.exports = plugin;
|
|
@@ -55,6 +55,13 @@ declare const _default: {
|
|
|
55
55
|
'@typescript-eslint/no-unused-vars': string;
|
|
56
56
|
'@typescript-eslint/no-empty-interface': string;
|
|
57
57
|
'@typescript-eslint/no-explicit-any': string;
|
|
58
|
+
/**
|
|
59
|
+
* During the migration to use ESLint v9 and typescript-eslint v8 for new workspaces,
|
|
60
|
+
* this rule would have created a lot of noise, so we are disabling it by default for now.
|
|
61
|
+
*
|
|
62
|
+
* TODO(v20): we should make this part of what we re-evaluate in v20
|
|
63
|
+
*/
|
|
64
|
+
'@typescript-eslint/no-require-imports': string;
|
|
58
65
|
};
|
|
59
66
|
};
|
|
60
67
|
export default _default;
|
|
@@ -64,5 +64,12 @@ exports.default = {
|
|
|
64
64
|
'@typescript-eslint/no-unused-vars': 'warn',
|
|
65
65
|
'@typescript-eslint/no-empty-interface': 'error',
|
|
66
66
|
'@typescript-eslint/no-explicit-any': 'warn',
|
|
67
|
+
/**
|
|
68
|
+
* During the migration to use ESLint v9 and typescript-eslint v8 for new workspaces,
|
|
69
|
+
* this rule would have created a lot of noise, so we are disabling it by default for now.
|
|
70
|
+
*
|
|
71
|
+
* TODO(v20): we should make this part of what we re-evaluate in v20
|
|
72
|
+
*/
|
|
73
|
+
'@typescript-eslint/no-require-imports': 'off',
|
|
67
74
|
},
|
|
68
75
|
};
|
|
@@ -37,6 +37,13 @@ declare const _default: {
|
|
|
37
37
|
'@typescript-eslint/no-unused-vars': string;
|
|
38
38
|
'@typescript-eslint/no-empty-interface': string;
|
|
39
39
|
'@typescript-eslint/no-explicit-any': string;
|
|
40
|
+
/**
|
|
41
|
+
* During the migration to use ESLint v9 and typescript-eslint v8 for new workspaces,
|
|
42
|
+
* this rule would have created a lot of noise, so we are disabling it by default for now.
|
|
43
|
+
*
|
|
44
|
+
* TODO(v20): we should make this part of what we re-evaluate in v20
|
|
45
|
+
*/
|
|
46
|
+
'@typescript-eslint/no-require-imports': string;
|
|
40
47
|
};
|
|
41
48
|
};
|
|
42
49
|
export default _default;
|
|
@@ -47,5 +47,12 @@ exports.default = {
|
|
|
47
47
|
'@typescript-eslint/no-unused-vars': 'warn',
|
|
48
48
|
'@typescript-eslint/no-empty-interface': 'error',
|
|
49
49
|
'@typescript-eslint/no-explicit-any': 'warn',
|
|
50
|
+
/**
|
|
51
|
+
* During the migration to use ESLint v9 and typescript-eslint v8 for new workspaces,
|
|
52
|
+
* this rule would have created a lot of noise, so we are disabling it by default for now.
|
|
53
|
+
*
|
|
54
|
+
* TODO(v20): we should make this part of what we re-evaluate in v20
|
|
55
|
+
*/
|
|
56
|
+
'@typescript-eslint/no-require-imports': 'off',
|
|
50
57
|
},
|
|
51
58
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This configuration is intended to be applied to ALL .html files in Angular
|
|
3
|
+
* projects within an Nx workspace, as well as extracted inline templates from
|
|
4
|
+
* .component.ts files (or similar).
|
|
5
|
+
*
|
|
6
|
+
* It should therefore NOT contain any rules or plugins which are related to
|
|
7
|
+
* Angular source code.
|
|
8
|
+
*
|
|
9
|
+
* NOTE: The processor to extract the inline templates is applied in users'
|
|
10
|
+
* configs by the relevant schematic.
|
|
11
|
+
*
|
|
12
|
+
* This configuration is intended to be combined with other configs from this
|
|
13
|
+
* package.
|
|
14
|
+
*/
|
|
15
|
+
declare const _default: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const angular_eslint_1 = tslib_1.__importDefault(require("angular-eslint"));
|
|
5
|
+
const typescript_eslint_1 = tslib_1.__importDefault(require("typescript-eslint"));
|
|
6
|
+
/**
|
|
7
|
+
* This configuration is intended to be applied to ALL .html files in Angular
|
|
8
|
+
* projects within an Nx workspace, as well as extracted inline templates from
|
|
9
|
+
* .component.ts files (or similar).
|
|
10
|
+
*
|
|
11
|
+
* It should therefore NOT contain any rules or plugins which are related to
|
|
12
|
+
* Angular source code.
|
|
13
|
+
*
|
|
14
|
+
* NOTE: The processor to extract the inline templates is applied in users'
|
|
15
|
+
* configs by the relevant schematic.
|
|
16
|
+
*
|
|
17
|
+
* This configuration is intended to be combined with other configs from this
|
|
18
|
+
* package.
|
|
19
|
+
*/
|
|
20
|
+
exports.default = typescript_eslint_1.default.config({
|
|
21
|
+
files: ['**/*.html'],
|
|
22
|
+
extends: [
|
|
23
|
+
...angular_eslint_1.default.configs.templateRecommended,
|
|
24
|
+
...angular_eslint_1.default.configs.templateAccessibility,
|
|
25
|
+
],
|
|
26
|
+
rules: {},
|
|
27
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This configuration is intended to be applied to ALL .ts files in Angular
|
|
3
|
+
* projects within an Nx workspace.
|
|
4
|
+
*
|
|
5
|
+
* It should therefore NOT contain any rules or plugins which are related to
|
|
6
|
+
* Angular Templates, or more cross-cutting concerns which are not specific
|
|
7
|
+
* to Angular.
|
|
8
|
+
*
|
|
9
|
+
* This configuration is intended to be combined with other configs from this
|
|
10
|
+
* package.
|
|
11
|
+
*/
|
|
12
|
+
declare const _default: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const angular_eslint_1 = tslib_1.__importDefault(require("angular-eslint"));
|
|
5
|
+
const globals_1 = tslib_1.__importDefault(require("globals"));
|
|
6
|
+
const typescript_eslint_1 = tslib_1.__importDefault(require("typescript-eslint"));
|
|
7
|
+
/**
|
|
8
|
+
* This configuration is intended to be applied to ALL .ts files in Angular
|
|
9
|
+
* projects within an Nx workspace.
|
|
10
|
+
*
|
|
11
|
+
* It should therefore NOT contain any rules or plugins which are related to
|
|
12
|
+
* Angular Templates, or more cross-cutting concerns which are not specific
|
|
13
|
+
* to Angular.
|
|
14
|
+
*
|
|
15
|
+
* This configuration is intended to be combined with other configs from this
|
|
16
|
+
* package.
|
|
17
|
+
*/
|
|
18
|
+
exports.default = typescript_eslint_1.default.config(...angular_eslint_1.default.configs.tsRecommended, {
|
|
19
|
+
languageOptions: {
|
|
20
|
+
globals: {
|
|
21
|
+
...globals_1.default.browser,
|
|
22
|
+
...globals_1.default.es2015,
|
|
23
|
+
...globals_1.default.node,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
processor: angular_eslint_1.default.processInlineTemplates,
|
|
27
|
+
plugins: { '@angular-eslint': angular_eslint_1.default.tsPlugin },
|
|
28
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This configuration is intended to be applied to ALL .js and .jsx files
|
|
3
|
+
* within an Nx workspace.
|
|
4
|
+
*
|
|
5
|
+
* It should therefore NOT contain any rules or plugins which are specific
|
|
6
|
+
* to one ecosystem, such as React, Angular, Node etc.
|
|
7
|
+
*
|
|
8
|
+
* We use @typescript-eslint/parser rather than the built in JS parser
|
|
9
|
+
* because that is what Nx ESLint configs have always done and we don't
|
|
10
|
+
* want to change too much all at once.
|
|
11
|
+
*
|
|
12
|
+
* TODO: Evaluate switching to the built-in JS parser (espree) in Nx v11,
|
|
13
|
+
* it should yield a performance improvement but could introduce subtle
|
|
14
|
+
* breaking changes - we should also look to replace all the @typescript-eslint
|
|
15
|
+
* related plugins and rules below.
|
|
16
|
+
*/
|
|
17
|
+
declare const _default: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
18
|
+
export default _default;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const js_1 = tslib_1.__importDefault(require("@eslint/js"));
|
|
5
|
+
const globals_1 = tslib_1.__importDefault(require("globals"));
|
|
6
|
+
const typescript_eslint_1 = tslib_1.__importDefault(require("typescript-eslint"));
|
|
7
|
+
const config_utils_1 = require("../utils/config-utils");
|
|
8
|
+
const isPrettierAvailable = (0, config_utils_1.packageExists)('prettier') && (0, config_utils_1.packageExists)('eslint-config-prettier');
|
|
9
|
+
/**
|
|
10
|
+
* This configuration is intended to be applied to ALL .js and .jsx files
|
|
11
|
+
* within an Nx workspace.
|
|
12
|
+
*
|
|
13
|
+
* It should therefore NOT contain any rules or plugins which are specific
|
|
14
|
+
* to one ecosystem, such as React, Angular, Node etc.
|
|
15
|
+
*
|
|
16
|
+
* We use @typescript-eslint/parser rather than the built in JS parser
|
|
17
|
+
* because that is what Nx ESLint configs have always done and we don't
|
|
18
|
+
* want to change too much all at once.
|
|
19
|
+
*
|
|
20
|
+
* TODO: Evaluate switching to the built-in JS parser (espree) in Nx v11,
|
|
21
|
+
* it should yield a performance improvement but could introduce subtle
|
|
22
|
+
* breaking changes - we should also look to replace all the @typescript-eslint
|
|
23
|
+
* related plugins and rules below.
|
|
24
|
+
*/
|
|
25
|
+
exports.default = typescript_eslint_1.default.config(js_1.default.configs.recommended, ...typescript_eslint_1.default.configs.recommended, ...(isPrettierAvailable ? [require('eslint-config-prettier')] : []), {
|
|
26
|
+
languageOptions: {
|
|
27
|
+
parser: typescript_eslint_1.default.parser,
|
|
28
|
+
ecmaVersion: 2020,
|
|
29
|
+
sourceType: 'module',
|
|
30
|
+
globals: {
|
|
31
|
+
...globals_1.default.browser,
|
|
32
|
+
...globals_1.default.node,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
plugins: { '@typescript-eslint': typescript_eslint_1.default.plugin },
|
|
36
|
+
}, {
|
|
37
|
+
files: ['**/*.js', '**/*.jsx'],
|
|
38
|
+
rules: {
|
|
39
|
+
'@typescript-eslint/explicit-member-accessibility': 'off',
|
|
40
|
+
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
41
|
+
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
42
|
+
'@typescript-eslint/no-parameter-properties': 'off',
|
|
43
|
+
/**
|
|
44
|
+
* Until ESM usage in Node matures, using require in e.g. JS config files
|
|
45
|
+
* is by far the more common thing to do, so disabling this to avoid users
|
|
46
|
+
* having to frequently use "eslint-disable-next-line" in their configs.
|
|
47
|
+
*/
|
|
48
|
+
'@typescript-eslint/no-var-requires': 'off',
|
|
49
|
+
/**
|
|
50
|
+
* From https://typescript-eslint.io/blog/announcing-typescript-eslint-v6/#updated-configuration-rules
|
|
51
|
+
*
|
|
52
|
+
* The following rules were added to preserve the linting rules that were
|
|
53
|
+
* previously defined v5 of `@typescript-eslint`. v6 of `@typescript-eslint`
|
|
54
|
+
* changed how configurations are defined.
|
|
55
|
+
*
|
|
56
|
+
* TODO(v20): re-evalute these deviations from @typescript-eslint/recommended in v20 of Nx
|
|
57
|
+
*/
|
|
58
|
+
'@typescript-eslint/no-non-null-assertion': 'warn',
|
|
59
|
+
'@typescript-eslint/adjacent-overload-signatures': 'error',
|
|
60
|
+
'@typescript-eslint/prefer-namespace-keyword': 'error',
|
|
61
|
+
'no-empty-function': 'off',
|
|
62
|
+
'@typescript-eslint/no-empty-function': 'error',
|
|
63
|
+
'@typescript-eslint/no-inferrable-types': 'error',
|
|
64
|
+
'@typescript-eslint/no-unused-vars': 'warn',
|
|
65
|
+
'@typescript-eslint/no-empty-interface': 'error',
|
|
66
|
+
'@typescript-eslint/no-explicit-any': 'warn',
|
|
67
|
+
/**
|
|
68
|
+
* During the migration to use ESLint v9 and typescript-eslint v8 for new workspaces,
|
|
69
|
+
* this rule would have created a lot of noise, so we are disabling it by default for now.
|
|
70
|
+
*
|
|
71
|
+
* TODO(v20): we should make this part of what we re-evaluate in v20
|
|
72
|
+
*/
|
|
73
|
+
'@typescript-eslint/no-require-imports': 'off',
|
|
74
|
+
},
|
|
75
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This configuration is intended to be applied to ALL files within a React
|
|
3
|
+
* project in an Nx workspace.
|
|
4
|
+
*
|
|
5
|
+
* It should therefore NOT contain any rules or plugins which are specific
|
|
6
|
+
* to one particular variant, e.g. TypeScript vs JavaScript, .js vs .jsx etc
|
|
7
|
+
*
|
|
8
|
+
* This configuration is intended to be combined with other configs from this
|
|
9
|
+
* package.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Rule set originally adapted from:
|
|
13
|
+
* https://github.com/facebook/create-react-app/blob/567f36c9235f1e1fd4a76dc6d1ae00be754ca047/packages/eslint-config-react-app/index.js
|
|
14
|
+
*/
|
|
15
|
+
declare const _default: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const compat_1 = require("@eslint/compat");
|
|
5
|
+
const importPlugin = tslib_1.__importStar(require("eslint-plugin-import"));
|
|
6
|
+
const globals_1 = tslib_1.__importDefault(require("globals"));
|
|
7
|
+
const typescript_eslint_1 = tslib_1.__importDefault(require("typescript-eslint"));
|
|
8
|
+
/**
|
|
9
|
+
* This configuration is intended to be applied to ALL files within a React
|
|
10
|
+
* project in an Nx workspace.
|
|
11
|
+
*
|
|
12
|
+
* It should therefore NOT contain any rules or plugins which are specific
|
|
13
|
+
* to one particular variant, e.g. TypeScript vs JavaScript, .js vs .jsx etc
|
|
14
|
+
*
|
|
15
|
+
* This configuration is intended to be combined with other configs from this
|
|
16
|
+
* package.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Rule set originally adapted from:
|
|
20
|
+
* https://github.com/facebook/create-react-app/blob/567f36c9235f1e1fd4a76dc6d1ae00be754ca047/packages/eslint-config-react-app/index.js
|
|
21
|
+
*/
|
|
22
|
+
exports.default = typescript_eslint_1.default.config({
|
|
23
|
+
plugins: { import: (0, compat_1.fixupPluginRules)(importPlugin) },
|
|
24
|
+
languageOptions: {
|
|
25
|
+
globals: {
|
|
26
|
+
...globals_1.default.browser,
|
|
27
|
+
...globals_1.default.commonjs,
|
|
28
|
+
...globals_1.default.es2015,
|
|
29
|
+
...globals_1.default.jest,
|
|
30
|
+
...globals_1.default.node,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
rules: {
|
|
34
|
+
/**
|
|
35
|
+
* Standard ESLint rule configurations
|
|
36
|
+
* https://eslint.org/docs/rules
|
|
37
|
+
*/
|
|
38
|
+
'array-callback-return': 'warn',
|
|
39
|
+
'dot-location': ['warn', 'property'],
|
|
40
|
+
eqeqeq: ['warn', 'smart'],
|
|
41
|
+
'new-parens': 'warn',
|
|
42
|
+
'no-caller': 'warn',
|
|
43
|
+
'no-cond-assign': ['warn', 'except-parens'],
|
|
44
|
+
'no-const-assign': 'warn',
|
|
45
|
+
'no-control-regex': 'warn',
|
|
46
|
+
'no-delete-var': 'warn',
|
|
47
|
+
'no-dupe-args': 'warn',
|
|
48
|
+
'no-dupe-keys': 'warn',
|
|
49
|
+
'no-duplicate-case': 'warn',
|
|
50
|
+
'no-empty-character-class': 'warn',
|
|
51
|
+
'no-empty-pattern': 'warn',
|
|
52
|
+
'no-eval': 'warn',
|
|
53
|
+
'no-ex-assign': 'warn',
|
|
54
|
+
'no-extend-native': 'warn',
|
|
55
|
+
'no-extra-bind': 'warn',
|
|
56
|
+
'no-extra-label': 'warn',
|
|
57
|
+
'no-fallthrough': 'warn',
|
|
58
|
+
'no-func-assign': 'warn',
|
|
59
|
+
'no-implied-eval': 'warn',
|
|
60
|
+
'no-invalid-regexp': 'warn',
|
|
61
|
+
'no-iterator': 'warn',
|
|
62
|
+
'no-label-var': 'warn',
|
|
63
|
+
'no-labels': ['warn', { allowLoop: true, allowSwitch: false }],
|
|
64
|
+
'no-lone-blocks': 'warn',
|
|
65
|
+
'no-loop-func': 'warn',
|
|
66
|
+
'no-mixed-operators': [
|
|
67
|
+
'warn',
|
|
68
|
+
{
|
|
69
|
+
groups: [
|
|
70
|
+
['&', '|', '^', '~', '<<', '>>', '>>>'],
|
|
71
|
+
['==', '!=', '===', '!==', '>', '>=', '<', '<='],
|
|
72
|
+
['&&', '||'],
|
|
73
|
+
['in', 'instanceof'],
|
|
74
|
+
],
|
|
75
|
+
allowSamePrecedence: false,
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
'no-multi-str': 'warn',
|
|
79
|
+
'no-native-reassign': 'warn',
|
|
80
|
+
'no-negated-in-lhs': 'warn',
|
|
81
|
+
'no-new-func': 'warn',
|
|
82
|
+
'no-new-object': 'warn',
|
|
83
|
+
'no-new-symbol': 'warn',
|
|
84
|
+
'no-new-wrappers': 'warn',
|
|
85
|
+
'no-obj-calls': 'warn',
|
|
86
|
+
'no-octal': 'warn',
|
|
87
|
+
'no-octal-escape': 'warn',
|
|
88
|
+
'no-redeclare': 'warn',
|
|
89
|
+
'no-regex-spaces': 'warn',
|
|
90
|
+
'no-restricted-syntax': ['warn', 'WithStatement'],
|
|
91
|
+
'no-script-url': 'warn',
|
|
92
|
+
'no-self-assign': 'warn',
|
|
93
|
+
'no-self-compare': 'warn',
|
|
94
|
+
'no-sequences': 'warn',
|
|
95
|
+
'no-shadow-restricted-names': 'warn',
|
|
96
|
+
'no-sparse-arrays': 'warn',
|
|
97
|
+
'no-template-curly-in-string': 'warn',
|
|
98
|
+
'no-this-before-super': 'warn',
|
|
99
|
+
'no-throw-literal': 'warn',
|
|
100
|
+
'no-restricted-globals': ['error', ...require('confusing-browser-globals')],
|
|
101
|
+
'no-unexpected-multiline': 'warn',
|
|
102
|
+
'no-unreachable': 'warn',
|
|
103
|
+
'no-unused-expressions': 'off',
|
|
104
|
+
'no-unused-labels': 'warn',
|
|
105
|
+
'no-useless-computed-key': 'warn',
|
|
106
|
+
'no-useless-concat': 'warn',
|
|
107
|
+
'no-useless-escape': 'warn',
|
|
108
|
+
'no-useless-rename': [
|
|
109
|
+
'warn',
|
|
110
|
+
{
|
|
111
|
+
ignoreDestructuring: false,
|
|
112
|
+
ignoreImport: false,
|
|
113
|
+
ignoreExport: false,
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
'no-with': 'warn',
|
|
117
|
+
'no-whitespace-before-property': 'warn',
|
|
118
|
+
'require-yield': 'warn',
|
|
119
|
+
'rest-spread-spacing': ['warn', 'never'],
|
|
120
|
+
strict: ['warn', 'never'],
|
|
121
|
+
'unicode-bom': ['warn', 'never'],
|
|
122
|
+
'use-isnan': 'warn',
|
|
123
|
+
'valid-typeof': 'warn',
|
|
124
|
+
'no-restricted-properties': [
|
|
125
|
+
'error',
|
|
126
|
+
{
|
|
127
|
+
object: 'require',
|
|
128
|
+
property: 'ensure',
|
|
129
|
+
message: 'Please use import() instead. More info: https://facebook.github.io/create-react-app/docs/code-splitting',
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
object: 'System',
|
|
133
|
+
property: 'import',
|
|
134
|
+
message: 'Please use import() instead. More info: https://facebook.github.io/create-react-app/docs/code-splitting',
|
|
135
|
+
},
|
|
136
|
+
],
|
|
137
|
+
'getter-return': 'warn',
|
|
138
|
+
/**
|
|
139
|
+
* Import rule configurations
|
|
140
|
+
* https://github.com/benmosher/eslint-plugin-import
|
|
141
|
+
*/
|
|
142
|
+
'import/first': 'error',
|
|
143
|
+
'import/no-amd': 'error',
|
|
144
|
+
'import/no-webpack-loader-syntax': 'error',
|
|
145
|
+
},
|
|
146
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This configuration is intended to be applied to ONLY files which contain JSX/TSX
|
|
3
|
+
* code.
|
|
4
|
+
*
|
|
5
|
+
* It should therefore NOT contain any rules or plugins which are generic
|
|
6
|
+
* to all file types within variants of React projects.
|
|
7
|
+
*
|
|
8
|
+
* This configuration is intended to be combined with other configs from this
|
|
9
|
+
* package.
|
|
10
|
+
*/
|
|
11
|
+
declare const _default: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const eslint_plugin_jsx_a11y_1 = tslib_1.__importDefault(require("eslint-plugin-jsx-a11y"));
|
|
5
|
+
const eslint_plugin_react_1 = tslib_1.__importDefault(require("eslint-plugin-react"));
|
|
6
|
+
const eslint_plugin_react_hooks_1 = tslib_1.__importDefault(require("eslint-plugin-react-hooks"));
|
|
7
|
+
const typescript_eslint_1 = tslib_1.__importDefault(require("typescript-eslint"));
|
|
8
|
+
/**
|
|
9
|
+
* This configuration is intended to be applied to ONLY files which contain JSX/TSX
|
|
10
|
+
* code.
|
|
11
|
+
*
|
|
12
|
+
* It should therefore NOT contain any rules or plugins which are generic
|
|
13
|
+
* to all file types within variants of React projects.
|
|
14
|
+
*
|
|
15
|
+
* This configuration is intended to be combined with other configs from this
|
|
16
|
+
* package.
|
|
17
|
+
*/
|
|
18
|
+
exports.default = typescript_eslint_1.default.config({
|
|
19
|
+
plugins: {
|
|
20
|
+
'react-hooks': eslint_plugin_react_hooks_1.default,
|
|
21
|
+
},
|
|
22
|
+
rules: eslint_plugin_react_hooks_1.default.configs.recommended.rules,
|
|
23
|
+
}, {
|
|
24
|
+
settings: { react: { version: 'detect' } },
|
|
25
|
+
plugins: {
|
|
26
|
+
'jsx-a11y': eslint_plugin_jsx_a11y_1.default,
|
|
27
|
+
react: eslint_plugin_react_1.default,
|
|
28
|
+
},
|
|
29
|
+
rules: {
|
|
30
|
+
/**
|
|
31
|
+
* React-specific rule configurations
|
|
32
|
+
* https://github.com/yannickcr/eslint-plugin-react
|
|
33
|
+
*/
|
|
34
|
+
'react/forbid-foreign-prop-types': ['warn', { allowInPropTypes: true }],
|
|
35
|
+
'react/jsx-no-comment-textnodes': 'warn',
|
|
36
|
+
'react/jsx-no-duplicate-props': 'warn',
|
|
37
|
+
'react/jsx-no-target-blank': 'warn',
|
|
38
|
+
'react/jsx-no-undef': 'error',
|
|
39
|
+
'react/jsx-pascal-case': ['warn', { allowAllCaps: true, ignore: [] }],
|
|
40
|
+
'react/jsx-uses-vars': 'warn',
|
|
41
|
+
'react/no-danger-with-children': 'warn',
|
|
42
|
+
'react/no-direct-mutation-state': 'warn',
|
|
43
|
+
'react/no-is-mounted': 'warn',
|
|
44
|
+
'react/no-typos': 'error',
|
|
45
|
+
'react/jsx-uses-react': 'off',
|
|
46
|
+
'react/react-in-jsx-scope': 'off',
|
|
47
|
+
'react/require-render-return': 'error',
|
|
48
|
+
'react/style-prop-object': 'warn',
|
|
49
|
+
'react/jsx-no-useless-fragment': 'warn',
|
|
50
|
+
/**
|
|
51
|
+
* JSX Accessibility rule configurations
|
|
52
|
+
* https://github.com/evcohen/eslint-plugin-jsx-a11y
|
|
53
|
+
*/
|
|
54
|
+
'jsx-a11y/accessible-emoji': 'warn',
|
|
55
|
+
'jsx-a11y/alt-text': 'warn',
|
|
56
|
+
'jsx-a11y/anchor-has-content': 'warn',
|
|
57
|
+
'jsx-a11y/anchor-is-valid': [
|
|
58
|
+
'warn',
|
|
59
|
+
{ aspects: ['noHref', 'invalidHref'] },
|
|
60
|
+
],
|
|
61
|
+
'jsx-a11y/aria-activedescendant-has-tabindex': 'warn',
|
|
62
|
+
'jsx-a11y/aria-props': 'warn',
|
|
63
|
+
'jsx-a11y/aria-proptypes': 'warn',
|
|
64
|
+
'jsx-a11y/aria-role': 'warn',
|
|
65
|
+
'jsx-a11y/aria-unsupported-elements': 'warn',
|
|
66
|
+
'jsx-a11y/heading-has-content': 'warn',
|
|
67
|
+
'jsx-a11y/iframe-has-title': 'warn',
|
|
68
|
+
'jsx-a11y/img-redundant-alt': 'warn',
|
|
69
|
+
'jsx-a11y/no-access-key': 'warn',
|
|
70
|
+
'jsx-a11y/no-distracting-elements': 'warn',
|
|
71
|
+
'jsx-a11y/no-redundant-roles': 'warn',
|
|
72
|
+
'jsx-a11y/role-has-required-aria-props': 'warn',
|
|
73
|
+
'jsx-a11y/role-supports-aria-props': 'warn',
|
|
74
|
+
'jsx-a11y/scope': 'warn',
|
|
75
|
+
},
|
|
76
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THIS IS A TEMPORARY CONFIG WHICH MATCHES THE CURRENT BEHAVIOR
|
|
3
|
+
* of including all the rules for all file types within the ESLint
|
|
4
|
+
* config for React projects.
|
|
5
|
+
*
|
|
6
|
+
* It will be refactored in a follow up PR to correctly apply rules
|
|
7
|
+
* to the right file types via overrides.
|
|
8
|
+
*/
|
|
9
|
+
declare const _default: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const typescript_eslint_1 = tslib_1.__importDefault(require("typescript-eslint"));
|
|
5
|
+
const react_base_1 = tslib_1.__importDefault(require("./react-base"));
|
|
6
|
+
const react_typescript_1 = tslib_1.__importDefault(require("./react-typescript"));
|
|
7
|
+
const react_jsx_1 = tslib_1.__importDefault(require("./react-jsx"));
|
|
8
|
+
/**
|
|
9
|
+
* THIS IS A TEMPORARY CONFIG WHICH MATCHES THE CURRENT BEHAVIOR
|
|
10
|
+
* of including all the rules for all file types within the ESLint
|
|
11
|
+
* config for React projects.
|
|
12
|
+
*
|
|
13
|
+
* It will be refactored in a follow up PR to correctly apply rules
|
|
14
|
+
* to the right file types via overrides.
|
|
15
|
+
*/
|
|
16
|
+
exports.default = typescript_eslint_1.default.config(...react_base_1.default, ...react_typescript_1.default, ...react_jsx_1.default);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This configuration is intended to be applied to ONLY .ts and .tsx files within a
|
|
3
|
+
* React project in an Nx workspace.
|
|
4
|
+
*
|
|
5
|
+
* It should therefore NOT contain any rules or plugins which are generic
|
|
6
|
+
* to all variants of React projects, e.g. TypeScript vs JavaScript, .js vs .jsx etc
|
|
7
|
+
*
|
|
8
|
+
* This configuration is intended to be combined with other configs from this
|
|
9
|
+
* package.
|
|
10
|
+
*/
|
|
11
|
+
declare const _default: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const typescript_eslint_1 = tslib_1.__importDefault(require("typescript-eslint"));
|
|
5
|
+
/**
|
|
6
|
+
* This configuration is intended to be applied to ONLY .ts and .tsx files within a
|
|
7
|
+
* React project in an Nx workspace.
|
|
8
|
+
*
|
|
9
|
+
* It should therefore NOT contain any rules or plugins which are generic
|
|
10
|
+
* to all variants of React projects, e.g. TypeScript vs JavaScript, .js vs .jsx etc
|
|
11
|
+
*
|
|
12
|
+
* This configuration is intended to be combined with other configs from this
|
|
13
|
+
* package.
|
|
14
|
+
*/
|
|
15
|
+
exports.default = typescript_eslint_1.default.config({
|
|
16
|
+
rules: {
|
|
17
|
+
// TypeScript"s `noFallthroughCasesInSwitch` option is more robust (#6906)
|
|
18
|
+
'default-case': 'off',
|
|
19
|
+
// "tsc" already handles this (https://github.com/typescript-eslint/typescript-eslint/issues/291)
|
|
20
|
+
'no-dupe-class-members': 'off',
|
|
21
|
+
// "tsc" already handles this (https://github.com/typescript-eslint/typescript-eslint/issues/477)
|
|
22
|
+
'no-undef': 'off',
|
|
23
|
+
// Add TypeScript specific rules (and turn off ESLint equivalents)
|
|
24
|
+
'no-array-constructor': 'off',
|
|
25
|
+
'@typescript-eslint/no-array-constructor': 'warn',
|
|
26
|
+
'@typescript-eslint/no-namespace': 'error',
|
|
27
|
+
'no-use-before-define': 'off',
|
|
28
|
+
'@typescript-eslint/no-use-before-define': [
|
|
29
|
+
'warn',
|
|
30
|
+
{
|
|
31
|
+
functions: false,
|
|
32
|
+
classes: false,
|
|
33
|
+
variables: false,
|
|
34
|
+
typedefs: false,
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
'no-unused-vars': 'off',
|
|
38
|
+
'@typescript-eslint/no-unused-vars': [
|
|
39
|
+
'warn',
|
|
40
|
+
{
|
|
41
|
+
args: 'none',
|
|
42
|
+
ignoreRestSiblings: true,
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
'no-useless-constructor': 'off',
|
|
46
|
+
'@typescript-eslint/no-useless-constructor': 'warn',
|
|
47
|
+
'@typescript-eslint/no-unused-expressions': [
|
|
48
|
+
'error',
|
|
49
|
+
{
|
|
50
|
+
allowShortCircuit: true,
|
|
51
|
+
allowTernary: true,
|
|
52
|
+
allowTaggedTemplates: true,
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This configuration is intended to be applied to ALL .ts and .tsx files
|
|
3
|
+
* within an Nx workspace.
|
|
4
|
+
*
|
|
5
|
+
* It should therefore NOT contain any rules or plugins which are specific
|
|
6
|
+
* to one ecosystem, such as React, Angular, Node etc.
|
|
7
|
+
*/
|
|
8
|
+
declare const _default: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const js_1 = tslib_1.__importDefault(require("@eslint/js"));
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const typescript_eslint_1 = tslib_1.__importDefault(require("typescript-eslint"));
|
|
7
|
+
const config_utils_1 = require("../utils/config-utils");
|
|
8
|
+
const isPrettierAvailable = (0, config_utils_1.packageExists)('prettier') && (0, config_utils_1.packageExists)('eslint-config-prettier');
|
|
9
|
+
/**
|
|
10
|
+
* This configuration is intended to be applied to ALL .ts and .tsx files
|
|
11
|
+
* within an Nx workspace.
|
|
12
|
+
*
|
|
13
|
+
* It should therefore NOT contain any rules or plugins which are specific
|
|
14
|
+
* to one ecosystem, such as React, Angular, Node etc.
|
|
15
|
+
*/
|
|
16
|
+
exports.default = typescript_eslint_1.default.config(js_1.default.configs.recommended, ...typescript_eslint_1.default.configs.recommended, ...(isPrettierAvailable ? [require('eslint-config-prettier')] : []), {
|
|
17
|
+
plugins: { '@typescript-eslint': typescript_eslint_1.default.plugin },
|
|
18
|
+
languageOptions: {
|
|
19
|
+
parser: typescript_eslint_1.default.parser,
|
|
20
|
+
ecmaVersion: 2020,
|
|
21
|
+
sourceType: 'module',
|
|
22
|
+
parserOptions: {
|
|
23
|
+
tsconfigRootDir: devkit_1.workspaceRoot,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
}, {
|
|
27
|
+
files: ['**/*.ts', '**/*.tsx'],
|
|
28
|
+
rules: {
|
|
29
|
+
'@typescript-eslint/explicit-member-accessibility': 'off',
|
|
30
|
+
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
31
|
+
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
32
|
+
'@typescript-eslint/no-parameter-properties': 'off',
|
|
33
|
+
/**
|
|
34
|
+
* From https://typescript-eslint.io/blog/announcing-typescript-eslint-v6/#updated-configuration-rules
|
|
35
|
+
*
|
|
36
|
+
* The following rules were added to preserve the linting rules that were
|
|
37
|
+
* previously defined v5 of `@typescript-eslint`. v6 of `@typescript-eslint`
|
|
38
|
+
* changed how configurations are defined.
|
|
39
|
+
*
|
|
40
|
+
* TODO(v20): re-evalute these deviations from @typescript-eslint/recommended in v20 of Nx
|
|
41
|
+
*/
|
|
42
|
+
'@typescript-eslint/no-non-null-assertion': 'warn',
|
|
43
|
+
'@typescript-eslint/adjacent-overload-signatures': 'error',
|
|
44
|
+
'@typescript-eslint/prefer-namespace-keyword': 'error',
|
|
45
|
+
'no-empty-function': 'off',
|
|
46
|
+
'@typescript-eslint/no-empty-function': 'error',
|
|
47
|
+
'@typescript-eslint/no-inferrable-types': 'error',
|
|
48
|
+
'@typescript-eslint/no-unused-vars': 'warn',
|
|
49
|
+
'@typescript-eslint/no-empty-interface': 'error',
|
|
50
|
+
'@typescript-eslint/no-explicit-any': 'warn',
|
|
51
|
+
/**
|
|
52
|
+
* During the migration to use ESLint v9 and typescript-eslint v8 for new workspaces,
|
|
53
|
+
* this rule would have created a lot of noise, so we are disabling it by default for now.
|
|
54
|
+
*
|
|
55
|
+
* TODO(v20): we should make this part of what we re-evaluate in v20
|
|
56
|
+
*/
|
|
57
|
+
'@typescript-eslint/no-require-imports': 'off',
|
|
58
|
+
},
|
|
59
|
+
});
|
package/src/index.js
CHANGED
|
@@ -9,6 +9,7 @@ const react_jsx_1 = tslib_1.__importDefault(require("./configs/react-jsx"));
|
|
|
9
9
|
const react_typescript_1 = tslib_1.__importDefault(require("./configs/react-typescript"));
|
|
10
10
|
const angular_1 = tslib_1.__importDefault(require("./configs/angular"));
|
|
11
11
|
const angular_template_1 = tslib_1.__importDefault(require("./configs/angular-template"));
|
|
12
|
+
const base_1 = tslib_1.__importDefault(require("./flat-configs/base"));
|
|
12
13
|
const enforce_module_boundaries_1 = tslib_1.__importStar(require("./rules/enforce-module-boundaries"));
|
|
13
14
|
const nx_plugin_checks_1 = tslib_1.__importStar(require("./rules/nx-plugin-checks"));
|
|
14
15
|
const dependency_checks_1 = tslib_1.__importStar(require("./rules/dependency-checks"));
|
|
@@ -16,6 +17,7 @@ const dependency_checks_1 = tslib_1.__importStar(require("./rules/dependency-che
|
|
|
16
17
|
const resolve_workspace_rules_1 = require("./resolve-workspace-rules");
|
|
17
18
|
module.exports = {
|
|
18
19
|
configs: {
|
|
20
|
+
// eslintrc configs
|
|
19
21
|
typescript: typescript_1.default,
|
|
20
22
|
javascript: javascript_1.default,
|
|
21
23
|
react: react_tmp_1.default,
|
|
@@ -24,6 +26,33 @@ module.exports = {
|
|
|
24
26
|
'react-jsx': react_jsx_1.default,
|
|
25
27
|
angular: angular_1.default,
|
|
26
28
|
'angular-template': angular_template_1.default,
|
|
29
|
+
// flat configs
|
|
30
|
+
// Note: Using getters here to avoid importing packages `angular-eslint` statically, which can lead to errors if not installed.
|
|
31
|
+
'flat/base': base_1.default,
|
|
32
|
+
get ['flat/typescript']() {
|
|
33
|
+
return require('./flat-configs/typescript').default;
|
|
34
|
+
},
|
|
35
|
+
get ['flat/javascript']() {
|
|
36
|
+
return require('./flat-configs/javascript').default;
|
|
37
|
+
},
|
|
38
|
+
get ['flat/react']() {
|
|
39
|
+
return require('./flat-configs/react-tmp').default;
|
|
40
|
+
},
|
|
41
|
+
get ['flat/react-base']() {
|
|
42
|
+
return require('./flat-configs/react-base').default;
|
|
43
|
+
},
|
|
44
|
+
get ['flat/react-typescript']() {
|
|
45
|
+
return require('./flat-configs/react-typescript').default;
|
|
46
|
+
},
|
|
47
|
+
get ['flat/react-jsx']() {
|
|
48
|
+
return require('./flat-configs/react-jsx').default;
|
|
49
|
+
},
|
|
50
|
+
get ['flat/angular']() {
|
|
51
|
+
return require('./flat-configs/angular').default;
|
|
52
|
+
},
|
|
53
|
+
get ['flat/angular-template']() {
|
|
54
|
+
return require('./flat-configs/angular-template').default;
|
|
55
|
+
},
|
|
27
56
|
},
|
|
28
57
|
rules: {
|
|
29
58
|
[enforce_module_boundaries_1.RULE_NAME]: enforce_module_boundaries_1.default,
|
|
@@ -13,5 +13,5 @@ export type Options = [
|
|
|
13
13
|
];
|
|
14
14
|
export type MessageIds = 'missingDependency' | 'obsoleteDependency' | 'versionMismatch' | 'missingDependencySection';
|
|
15
15
|
export declare const RULE_NAME = "dependency-checks";
|
|
16
|
-
declare const _default: ESLintUtils.RuleModule<MessageIds, Options, ESLintUtils.RuleListener>;
|
|
16
|
+
declare const _default: ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
|
|
17
17
|
export default _default;
|
|
@@ -16,7 +16,6 @@ exports.default = utils_1.ESLintUtils.RuleCreator(() => `https://github.com/nrwl
|
|
|
16
16
|
type: 'suggestion',
|
|
17
17
|
docs: {
|
|
18
18
|
description: `Checks dependencies in project's package.json for version mismatches`,
|
|
19
|
-
recommended: 'recommended',
|
|
20
19
|
},
|
|
21
20
|
fixable: 'code',
|
|
22
21
|
schema: [
|
|
@@ -15,5 +15,5 @@ type Options = [
|
|
|
15
15
|
];
|
|
16
16
|
export type MessageIds = 'noRelativeOrAbsoluteImportsAcrossLibraries' | 'noRelativeOrAbsoluteExternals' | 'noSelfCircularDependencies' | 'noCircularDependencies' | 'noImportsOfApps' | 'noImportsOfE2e' | 'noImportOfNonBuildableLibraries' | 'noImportsOfLazyLoadedLibraries' | 'projectWithoutTagsCannotHaveDependencies' | 'bannedExternalImportsViolation' | 'nestedBannedExternalImportsViolation' | 'noTransitiveDependencies' | 'onlyTagsConstraintViolation' | 'emptyOnlyTagsConstraintViolation' | 'notTagsConstraintViolation';
|
|
17
17
|
export declare const RULE_NAME = "enforce-module-boundaries";
|
|
18
|
-
declare const _default: ESLintUtils.RuleModule<MessageIds, Options, ESLintUtils.RuleListener>;
|
|
18
|
+
declare const _default: ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
|
|
19
19
|
export default _default;
|
|
@@ -17,7 +17,6 @@ exports.default = utils_1.ESLintUtils.RuleCreator(() => `https://github.com/nrwl
|
|
|
17
17
|
type: 'suggestion',
|
|
18
18
|
docs: {
|
|
19
19
|
description: `Ensure that module boundaries are respected within the monorepo`,
|
|
20
|
-
recommended: 'recommended',
|
|
21
20
|
},
|
|
22
21
|
fixable: 'code',
|
|
23
22
|
schema: [
|
|
@@ -11,7 +11,7 @@ type Options = [
|
|
|
11
11
|
];
|
|
12
12
|
export type MessageIds = 'missingRequiredSchema' | 'invalidSchemaPath' | 'missingImplementation' | 'invalidImplementationPath' | 'invalidImplementationModule' | 'unableToReadImplementationExports' | 'invalidVersion' | 'missingVersion' | 'noGeneratorsOrSchematicsFound' | 'noExecutorsOrBuildersFound' | 'valueShouldBeObject';
|
|
13
13
|
export declare const RULE_NAME = "nx-plugin-checks";
|
|
14
|
-
declare const _default: TSESLint.RuleModule<MessageIds, Options, TSESLint.RuleListener>;
|
|
14
|
+
declare const _default: TSESLint.RuleModule<MessageIds, Options, unknown, TSESLint.RuleListener>;
|
|
15
15
|
export default _default;
|
|
16
16
|
export declare function checkCollectionFileNode(baseNode: AST.JSONObjectExpression, mode: 'migration' | 'generator' | 'executor', context: TSESLint.RuleContext<MessageIds, Options>): void;
|
|
17
17
|
export declare function checkCollectionNode(baseNode: AST.JSONObjectExpression, mode: 'migration' | 'generator' | 'executor', context: TSESLint.RuleContext<MessageIds, Options>): void;
|
package/typescript.d.ts
ADDED
package/typescript.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const javascript_1 = tslib_1.__importDefault(require("./src/flat-configs/javascript"));
|
|
5
|
+
const typescript_1 = tslib_1.__importDefault(require("./src/flat-configs/typescript"));
|
|
6
|
+
const plugin = {
|
|
7
|
+
configs: {
|
|
8
|
+
javascript: javascript_1.default,
|
|
9
|
+
typescript: typescript_1.default,
|
|
10
|
+
},
|
|
11
|
+
rules: {},
|
|
12
|
+
};
|
|
13
|
+
// ESM
|
|
14
|
+
exports.default = plugin;
|
|
15
|
+
// CommonJS
|
|
16
|
+
module.exports = plugin;
|