@pob/eslint-config 64.2.0 → 65.0.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/lib/index.js CHANGED
@@ -1,17 +1,42 @@
1
+ import tseslint from "typescript-eslint";
1
2
  import baseConfigs from "./_base.js";
2
3
  import baseCommonjsConfig from "./base/commonjs.js";
3
4
  import baseModuleConfig from "./base/module.js";
4
5
  import nodePluginCommonjsConfigs from "./node/commonjs.js";
5
6
  import nodePluginModuleConfigs from "./node/module.js";
7
+ import allowImplicitReturnTypeConfig from "./overrides/allow-implicit-return-type.js";
8
+ import allowUnsafeAsWarnConfig from "./overrides/allow-unsafe-as-warn.js";
9
+ import allowUnsafeConfig from "./overrides/allow-unsafe.js";
10
+ import appConfig from "./overrides/app.js";
6
11
  import scriptsOverrideConfig from "./overrides/scripts.js";
7
12
  import testOverrideConfig from "./overrides/test.js";
8
13
  import importPluginBaseConfigs from "./plugins/import/import-base.js";
9
14
  import importPluginCommonjsConfig from "./plugins/import/import-commonjs.js";
10
15
  import importPluginModuleConfig from "./plugins/import/import-module.js";
16
+ import typescriptReplaceEslintConfig from "./plugins/typescript-eslint/typescript-eslint-replace-eslint.js";
17
+ import typescriptReplaceUnicornConfig from "./plugins/typescript-eslint/typescript-eslint-replace-unicorn.js";
18
+ import typescriptPluginRulesConfig from "./plugins/typescript-eslint/typescript-eslint-rules.js";
19
+ import typescriptRulesConfig from "./rules/typescript.js";
11
20
  import { apply } from "./utils/apply.js";
12
21
 
13
22
  export { apply } from "./utils/apply.js";
14
23
 
24
+ export const tsExtensions = "{ts,cts,mts,tsx}";
25
+
26
+ export const applyTs = (options) =>
27
+ apply({
28
+ extensions: tsExtensions,
29
+ ...options,
30
+ });
31
+
32
+ // @ts-expect-error -- missing files declaration
33
+ const tsFiles = tseslint.configs.strictTypeChecked[1].files;
34
+ if (!tsFiles) {
35
+ throw new Error(
36
+ 'Unexpected "tseslint.configs.strictTypeChecked[1].files" value',
37
+ );
38
+ }
39
+
15
40
  export default () => {
16
41
  const extensions = "{js,cjs,mjs}";
17
42
 
@@ -21,6 +46,30 @@ export default () => {
21
46
  `**/__mocks__/**/*.${extensions}`,
22
47
  ];
23
48
 
49
+ const tsTestFiles = [
50
+ `**/*.test(-e2e)?${tsExtensions}`,
51
+ `**/__tests__/**/*.${tsExtensions}`,
52
+ `**/__mocks__/**/*.${tsExtensions}`,
53
+ ];
54
+
55
+ const typescriptConfigs = [
56
+ ...applyTs({
57
+ filesOverridesIf: [tsFiles],
58
+ configs: [
59
+ ...tseslint.configs.strictTypeChecked,
60
+ typescriptReplaceUnicornConfig,
61
+ typescriptReplaceEslintConfig,
62
+ typescriptPluginRulesConfig,
63
+ typescriptRulesConfig,
64
+ ],
65
+ }),
66
+ ...apply({
67
+ files: testFiles,
68
+ configs: [testOverrideConfig],
69
+ }),
70
+ ];
71
+
72
+ /** @deprecated */
24
73
  const nodeCommonjs = [
25
74
  ...baseConfigs,
26
75
  ...apply({
@@ -79,6 +128,8 @@ export default () => {
79
128
  files: testFiles,
80
129
  configs: [testOverrideConfig],
81
130
  }),
131
+
132
+ ...typescriptConfigs,
82
133
  ];
83
134
 
84
135
  const nodeModule = [
@@ -101,13 +152,39 @@ export default () => {
101
152
  files: ["**/*.{cjs,cts}"],
102
153
  configs: [...nodePluginCommonjsConfigs],
103
154
  }),
155
+
156
+ ...typescriptConfigs,
157
+
158
+ ...apply({
159
+ files: tsTestFiles,
160
+ configs: [testOverrideConfig],
161
+ }),
104
162
  ];
105
163
 
106
164
  return {
107
165
  configs: {
108
166
  baseModule,
167
+ /** @deprecated */
109
168
  nodeModule,
169
+ /** @deprecated */
110
170
  nodeCommonjs,
171
+ node: nodeModule,
172
+
173
+ allowImplicitReturnType: applyTs({
174
+ configs: [allowImplicitReturnTypeConfig],
175
+ }),
176
+
177
+ allowUnsafe: applyTs({
178
+ configs: [allowUnsafeConfig],
179
+ }),
180
+
181
+ allowUnsafeAsWarn: applyTs({
182
+ configs: [allowUnsafeAsWarnConfig],
183
+ }),
184
+
185
+ app: applyTs({
186
+ configs: [appConfig],
187
+ }),
111
188
  },
112
189
  };
113
190
  };
@@ -0,0 +1,7 @@
1
+ export default {
2
+ name: "@pob/eslint-config/overrides/allow-implicit-return-type",
3
+ rules: {
4
+ "@typescript-eslint/explicit-function-return-type": "off",
5
+ "@typescript-eslint/explicit-module-boundary-types": "off",
6
+ },
7
+ };
@@ -0,0 +1,10 @@
1
+ export default {
2
+ name: "@pob/eslint-config/overrides/allow-unsafe-as-warn",
3
+ rules: {
4
+ "@typescript-eslint/no-unsafe-argument": "warn",
5
+ "@typescript-eslint/no-unsafe-assignment": "warn",
6
+ "@typescript-eslint/no-unsafe-call": "warn",
7
+ "@typescript-eslint/no-unsafe-member-access": "warn",
8
+ "@typescript-eslint/no-unsafe-return": "warn",
9
+ },
10
+ };
@@ -0,0 +1,10 @@
1
+ export default {
2
+ name: "@pob/eslint-config/overrides/allow-unsafe",
3
+ rules: {
4
+ "@typescript-eslint/no-unsafe-argument": "off",
5
+ "@typescript-eslint/no-unsafe-assignment": "off",
6
+ "@typescript-eslint/no-unsafe-call": "off",
7
+ "@typescript-eslint/no-unsafe-member-access": "off",
8
+ "@typescript-eslint/no-unsafe-return": "off",
9
+ },
10
+ };
@@ -0,0 +1,8 @@
1
+ export default {
2
+ name: "@pob/eslint-config/overrides/app",
3
+ rules: {
4
+ /* No need for this rule in an app */
5
+ "@typescript-eslint/explicit-module-boundary-types": "off",
6
+ "@typescript-eslint/explicit-function-return-type": "off",
7
+ },
8
+ };
@@ -1,8 +1,41 @@
1
- export default {
2
- name: "@pob/eslint-config/test",
1
+ export default [
2
+ {
3
+ name: "@pob/eslint-config/test",
3
4
 
4
- rules: {
5
- // allow dev dependencies
6
- "import-x/no-extraneous-dependencies": ["error", { devDependencies: true }],
5
+ rules: {
6
+ // allow dev dependencies
7
+ "import-x/no-extraneous-dependencies": [
8
+ "error",
9
+ { devDependencies: true },
10
+ ],
11
+ },
7
12
  },
8
- };
13
+ {
14
+ name: "@pob/eslint-config/test-typescript",
15
+
16
+ rules: {
17
+ // enable (as any).something in test
18
+ "@typescript-eslint/no-unsafe-member-access": "off",
19
+
20
+ // jest.mock in test
21
+ "@typescript-eslint/no-unsafe-return": "off",
22
+
23
+ // don't force return type in test
24
+ "@typescript-eslint/explicit-function-return-type": "off",
25
+
26
+ // https://github.com/nodejs/node/issues/51292
27
+ "@typescript-eslint/no-floating-promises": [
28
+ "error",
29
+ {
30
+ allowForKnownSafeCalls: [
31
+ {
32
+ from: "package",
33
+ name: ["it", "describe", "test"],
34
+ package: "node:test",
35
+ },
36
+ ],
37
+ },
38
+ ],
39
+ },
40
+ },
41
+ ];
@@ -15,6 +15,7 @@ export default [
15
15
  "import-x/parsers": {
16
16
  // https://github.com/un-ts/eslint-plugin-import-x/issues/2556#issuecomment-1419518561
17
17
  espree: [".js", ".cjs", ".mjs"],
18
+ "@typescript-eslint/parser": [".ts"],
18
19
  },
19
20
  "import-x/resolver-next": [createNodeResolver()],
20
21
  },
@@ -123,4 +124,13 @@ export default [
123
124
  "import-x/order": "off",
124
125
  },
125
126
  },
127
+
128
+ {
129
+ name: "@pob/eslint-config/import/typescript",
130
+ files: ["*.ts"],
131
+ rules: {
132
+ // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/consistent-type-specifier-style.md
133
+ "import-x/consistent-type-specifier-style": "error",
134
+ },
135
+ },
126
136
  ];
@@ -0,0 +1,17 @@
1
+ export default {
2
+ name: "@pob/eslint-config/plugins/node",
3
+
4
+ rules: {
5
+ // Disable rules already checked by import plugin
6
+ "n/no-unpublished-require": "off",
7
+ "n/no-extraneous-require": "off",
8
+ "n/no-unpublished-import": "off",
9
+ "n/no-extraneous-import": "off",
10
+ "n/no-missing-require": "off",
11
+ "n/no-missing-import": "off",
12
+
13
+ // disable no-unsupported-features when using babel
14
+ "n/no-unsupported-features/es-builtins": "off",
15
+ "n/no-unsupported-features/es-syntax": "off",
16
+ },
17
+ };
@@ -0,0 +1,126 @@
1
+ import pobBestPracticesConfig from "@pob/eslint-config/lib/rules/best-practices";
2
+ import pobCodeQualityConfig from "@pob/eslint-config/lib/rules/code-quality";
3
+ import pobErrorsConfig from "@pob/eslint-config/lib/rules/errors";
4
+ import pobStyleConfig from "@pob/eslint-config/lib/rules/style";
5
+
6
+ const getRuleValue = (config, ruleName) => {
7
+ const value = config[ruleName];
8
+ if (value == null) {
9
+ throw new Error(`getRuleValue: missing value for rule "${ruleName}"`);
10
+ }
11
+
12
+ return value;
13
+ };
14
+
15
+ const replaceRules = (config, ruleNames) => {
16
+ return Object.fromEntries(
17
+ ruleNames.flatMap((ruleName) => [
18
+ [ruleName, "off"],
19
+ [`@typescript-eslint/${ruleName}`, getRuleValue(config, ruleName)],
20
+ ]),
21
+ );
22
+ };
23
+
24
+ const disabledRules = (ruleNames) => {
25
+ return Object.fromEntries(
26
+ ruleNames.map((ruleName) => {
27
+ [
28
+ pobBestPracticesConfig.rules,
29
+ pobCodeQualityConfig.rules,
30
+ pobErrorsConfig.rules,
31
+ pobStyleConfig.rules,
32
+ ].forEach((config) => {
33
+ const value = config[ruleName];
34
+ if (value != null && value !== "off") {
35
+ throw new Error(`disabledRules: value for rule "${ruleName}" exists`);
36
+ }
37
+ });
38
+ return [ruleName, "off"];
39
+ }),
40
+ );
41
+ };
42
+
43
+ const disableRules = (ruleNames) => {
44
+ return Object.fromEntries(ruleNames.map((ruleName) => [ruleName, "off"]));
45
+ };
46
+
47
+ export default {
48
+ name: "@pob/eslint-config/typescript-eslint/replace-eslint",
49
+ /* Replace enabled rules in Airbnb by typescript-eslint rules */
50
+ rules: {
51
+ ...replaceRules(pobBestPracticesConfig.rules, [
52
+ // https://typescript-eslint.io/rules/default-param-last
53
+ "default-param-last",
54
+ // https://typescript-eslint.io/rules/dot-notation
55
+ "dot-notation",
56
+ // https://typescript-eslint.io/rules/no-array-constructor
57
+ "no-array-constructor",
58
+ // https://typescript-eslint.io/rules/no-dupe-class-members
59
+ "no-dupe-class-members",
60
+ // https://typescript-eslint.io/rules/no-empty-function
61
+ "no-empty-function",
62
+ // https://typescript-eslint.io/rules/no-implied-eval
63
+ "no-implied-eval",
64
+ // https://typescript-eslint.io/rules/no-loop-func
65
+ "no-loop-func",
66
+ // https://typescript-eslint.io/rules/no-unused-expressions
67
+ "no-unused-expressions",
68
+ // https://typescript-eslint.io/rules/no-unused-vars
69
+ "no-unused-vars",
70
+ // https://typescript-eslint.io/rules/no-use-before-define
71
+ "no-use-before-define",
72
+ // https://typescript-eslint.io/rules/no-useless-constructor
73
+ "no-useless-constructor",
74
+ // https://typescript-eslint.io/rules/require-await
75
+ "require-await",
76
+ // https://typescript-eslint.io/rules/consistent-return
77
+ "consistent-return",
78
+ // https://typescript-eslint.io/rules/class-methods-use-this
79
+ "class-methods-use-this",
80
+ // https://typescript-eslint.io/rules/max-params
81
+ "max-params",
82
+ ]),
83
+
84
+ ...disabledRules([
85
+ // https://typescript-eslint.io/rules/brace-style
86
+ "brace-style",
87
+ // https://typescript-eslint.io/rules/comma-dangle
88
+ "comma-dangle",
89
+ // https://typescript-eslint.io/rules/comma-spacing
90
+ "comma-spacing",
91
+ // https://typescript-eslint.io/rules/func-call-spacing
92
+ "func-call-spacing",
93
+ // https://typescript-eslint.io/rules/indent
94
+ "indent",
95
+ // https://typescript-eslint.io/rules/init-declarations
96
+ "init-declarations",
97
+ // https://typescript-eslint.io/rules/keyword-spacing
98
+ "keyword-spacing",
99
+ // https://typescript-eslint.io/rules/lines-between-class-members
100
+ "lines-between-class-members",
101
+ // https://typescript-eslint.io/rules/no-magic-numbers
102
+ "no-magic-numbers",
103
+ // https://typescript-eslint.io/rules/no-restricted-imports
104
+ "no-restricted-imports",
105
+ // https://typescript-eslint.io/rules/no-shadow
106
+ "no-shadow",
107
+ // https://typescript-eslint.io/rules/object-curly-spacing
108
+ "object-curly-spacing",
109
+ // https://typescript-eslint.io/rules/padding-line-between-statements
110
+ "padding-line-between-statements",
111
+ // https://typescript-eslint.io/rules/semi
112
+ "semi",
113
+ // https://typescript-eslint.io/rules/prefer-destructuring
114
+ "prefer-destructuring",
115
+ ]),
116
+
117
+ /* covered by tsc */
118
+
119
+ ...disableRules([
120
+ // https://typescript-eslint.io/rules/no-invalid-this
121
+ "no-invalid-this",
122
+ // https://typescript-eslint.io/rules/no-redeclare
123
+ "no-redeclare",
124
+ ]),
125
+ },
126
+ };
@@ -0,0 +1,13 @@
1
+ export default {
2
+ name: "@pob/eslint-config/typescript-eslint/replace-unicorn",
3
+
4
+ /* Replace unicorn rules by better type-aware typescript-eslint rules */
5
+ rules: {
6
+ "unicorn/prefer-string-starts-ends-with": "off",
7
+ "unicorn/prefer-string-slice": "off",
8
+ "@typescript-eslint/prefer-string-starts-ends-with": "error",
9
+
10
+ "unicorn/prefer-array-find": "off",
11
+ "@typescript-eslint/prefer-find": "error",
12
+ },
13
+ };
@@ -0,0 +1,213 @@
1
+ import { enableIfVSCode } from "@pob/eslint-config/utils";
2
+
3
+ export default {
4
+ name: "@pob/eslint-config/typescript-eslint/rules",
5
+
6
+ rules: {
7
+ // https://typescript-eslint.io/rules/adjacent-overload-signatures/
8
+ "@typescript-eslint/adjacent-overload-signatures": "error",
9
+
10
+ // https://typescript-eslint.io/rules/array-type/
11
+ "@typescript-eslint/array-type": "error",
12
+
13
+ // https://typescript-eslint.io/rules/ban-tslint-comment/
14
+ "@typescript-eslint/ban-tslint-comment": "error",
15
+
16
+ // https://typescript-eslint.io/rules/class-literal-property-style/
17
+ "@typescript-eslint/class-literal-property-style": "error",
18
+
19
+ // https://typescript-eslint.io/rules/consistent-generic-constructors/
20
+ "@typescript-eslint/consistent-generic-constructors": "error",
21
+
22
+ // https://typescript-eslint.io/rules/consistent-indexed-object-style/
23
+ "@typescript-eslint/consistent-indexed-object-style": "error",
24
+
25
+ // https://typescript-eslint.io/rules/consistent-type-assertions/
26
+ "@typescript-eslint/consistent-type-assertions": [
27
+ "error",
28
+ {
29
+ assertionStyle: "as",
30
+ objectLiteralTypeAssertions: "allow-as-parameter",
31
+ },
32
+ ],
33
+
34
+ // https://typescript-eslint.io/rules/consistent-type-definitions/
35
+ "@typescript-eslint/consistent-type-definitions": "error",
36
+
37
+ // https://typescript-eslint.io/rules/consistent-type-exports/
38
+ "@typescript-eslint/consistent-type-exports": "error",
39
+
40
+ // https://typescript-eslint.io/rules/consistent-type-imports/
41
+ "@typescript-eslint/consistent-type-imports": "error",
42
+
43
+ // https://typescript-eslint.io/rules/explicit-function-return-type/
44
+ "@typescript-eslint/explicit-function-return-type": [
45
+ "error",
46
+ {
47
+ allowExpressions: true,
48
+ allowTypedFunctionExpressions: true,
49
+ allowHigherOrderFunctions: true,
50
+ allowDirectConstAssertionInArrowFunctions: true,
51
+ allowConciseArrowFunctionExpressionsStartingWithVoid: false,
52
+ allowFunctionsWithoutTypeParameters: false,
53
+ allowedNames: [],
54
+ allowIIFEs: false,
55
+ },
56
+ ],
57
+
58
+ // https://typescript-eslint.io/rules/explicit-member-accessibility/
59
+ "@typescript-eslint/explicit-member-accessibility": "off",
60
+
61
+ // https://typescript-eslint.io/rules/explicit-module-boundary-types/
62
+ "@typescript-eslint/explicit-module-boundary-types": "error",
63
+
64
+ // https://typescript-eslint.io/rules/method-signature-style/
65
+ "@typescript-eslint/method-signature-style": "error",
66
+
67
+ // https://typescript-eslint.io/rules/naming-convention/
68
+ "@typescript-eslint/naming-convention": [
69
+ enableIfVSCode("warn"),
70
+ // Enforce that interface names do not begin with an I
71
+ {
72
+ selector: "interface",
73
+ format: ["PascalCase"],
74
+ custom: {
75
+ regex: "^I[A-Z]",
76
+ match: false,
77
+ },
78
+ },
79
+ // Enforce that type is in PascalCase
80
+ {
81
+ selector: "typeLike",
82
+ format: ["PascalCase"],
83
+ },
84
+ ],
85
+
86
+ // https://typescript-eslint.io/rules/no-confusing-non-null-assertion/
87
+ "@typescript-eslint/no-confusing-non-null-assertion": "error",
88
+
89
+ // https://typescript-eslint.io/rules/no-import-type-side-effects/
90
+ "@typescript-eslint/no-import-type-side-effects": "error",
91
+
92
+ // https://typescript-eslint.io/rules/no-inferrable-types/
93
+ "@typescript-eslint/no-inferrable-types": "error",
94
+
95
+ // https://typescript-eslint.io/rules/no-require-imports/
96
+ "@typescript-eslint/no-require-imports": "off",
97
+
98
+ // https://typescript-eslint.io/rules/no-unnecessary-qualifier/
99
+ "@typescript-eslint/no-unnecessary-qualifier": "error",
100
+
101
+ // https://typescript-eslint.io/rules/no-unsafe-unary-minus/
102
+ "@typescript-eslint/no-unsafe-unary-minus": "error",
103
+
104
+ // https://typescript-eslint.io/rules/no-useless-empty-export/
105
+ "@typescript-eslint/no-useless-empty-export": "error",
106
+
107
+ // https://typescript-eslint.io/rules/non-nullable-type-assertion-style/
108
+ "@typescript-eslint/non-nullable-type-assertion-style": "error",
109
+
110
+ // https://typescript-eslint.io/rules/parameter-properties/
111
+ "@typescript-eslint/parameter-properties": "error",
112
+
113
+ // https://typescript-eslint.io/rules/prefer-enum-initializers/
114
+ "@typescript-eslint/prefer-enum-initializers": "error",
115
+
116
+ // https://typescript-eslint.io/rules/prefer-find/
117
+ "@typescript-eslint/prefer-find": "error",
118
+
119
+ // https://typescript-eslint.io/rules/prefer-for-of/
120
+ "@typescript-eslint/prefer-for-of": "off",
121
+
122
+ // https://typescript-eslint.io/rules/prefer-function-type/
123
+ "@typescript-eslint/prefer-function-type": "error",
124
+
125
+ // https://typescript-eslint.io/rules/prefer-namespace-keyword/
126
+ "@typescript-eslint/prefer-namespace-keyword": "error",
127
+
128
+ // https://typescript-eslint.io/rules/prefer-nullish-coalescing/
129
+ "@typescript-eslint/prefer-nullish-coalescing": "off",
130
+
131
+ // https://typescript-eslint.io/rules/prefer-optional-chain/
132
+ "@typescript-eslint/prefer-optional-chain": "error",
133
+
134
+ // https://typescript-eslint.io/rules/prefer-readonly/
135
+ "@typescript-eslint/prefer-readonly": "off",
136
+
137
+ // https://typescript-eslint.io/rules/prefer-readonly-parameter-types/
138
+ // too verbose and eslint already makes sure we don't modify parameters
139
+ "@typescript-eslint/prefer-readonly-parameter-types": "off",
140
+
141
+ // https://typescript-eslint.io/rules/prefer-regexp-exec/
142
+ "@typescript-eslint/prefer-regexp-exec": "error",
143
+
144
+ // https://typescript-eslint.io/rules/prefer-string-starts-ends-with/
145
+ "@typescript-eslint/prefer-string-starts-ends-with": "error",
146
+
147
+ // https://typescript-eslint.io/rules/promise-function-async/
148
+ "@typescript-eslint/promise-function-async": "off",
149
+
150
+ // https://typescript-eslint.io/rules/require-array-sort-compare/
151
+ "@typescript-eslint/require-array-sort-compare": "off",
152
+
153
+ // https://typescript-eslint.io/rules/restrict-template-expressions/
154
+ "@typescript-eslint/restrict-template-expressions": [
155
+ "error",
156
+ {
157
+ allowAny: false,
158
+ allowBoolean: true,
159
+ allowNullish: false,
160
+ allowNumber: true,
161
+ allowRegExp: false,
162
+ allowNever: false,
163
+ },
164
+ ],
165
+
166
+ // https://typescript-eslint.io/rules/sort-type-constituents/
167
+ "@typescript-eslint/sort-type-constituents": "error",
168
+
169
+ // https://typescript-eslint.io/rules/strict-boolean-expressions/
170
+ "@typescript-eslint/strict-boolean-expressions": "off",
171
+
172
+ // https://typescript-eslint.io/rules/switch-exhaustiveness-check/
173
+ "@typescript-eslint/switch-exhaustiveness-check": "error",
174
+
175
+ // https://typescript-eslint.io/rules/ban-ts-comment/
176
+ "@typescript-eslint/ban-ts-comment": [
177
+ "error",
178
+ {
179
+ minimumDescriptionLength: 3,
180
+ "ts-check": true, // default is false. We don't want to use ts-check like ts-nocheck and prefer instead ts-expect-error
181
+ "ts-expect-error": "allow-with-description",
182
+ "ts-ignore": true,
183
+ "ts-nocheck": true,
184
+ },
185
+ ],
186
+
187
+ // https://typescript-eslint.io/rules/typedef/
188
+ "@typescript-eslint/typedef": "off",
189
+
190
+ /* warnings: not required to be fixed, but should require attention */
191
+ "@typescript-eslint/no-explicit-any": "warn",
192
+ "@typescript-eslint/no-non-null-assertion": "warn",
193
+ "@typescript-eslint/no-redundant-type-constituents": "warn",
194
+
195
+ /* Disabled */
196
+
197
+ // too much errors on existing code
198
+ "@typescript-eslint/unbound-method": "off",
199
+
200
+ // most of the time it's sorted by the developer as it is easier to read
201
+ "@typescript-eslint/sort-type-union-intersection-members": "off",
202
+
203
+ "@typescript-eslint/member-ordering": "off",
204
+ "@typescript-eslint/no-extraneous-class": "off",
205
+ "@typescript-eslint/no-unnecessary-type-arguments": "off",
206
+
207
+ // Testing rules as warn
208
+ "@typescript-eslint/unified-signatures": "warn",
209
+ "@typescript-eslint/no-unnecessary-condition": "warn",
210
+ "@typescript-eslint/no-confusing-void-expression": "warn",
211
+ "@typescript-eslint/no-unnecessary-type-parameters": "warn",
212
+ },
213
+ };
@@ -0,0 +1,26 @@
1
+ import { createNodeResolver } from "eslint-plugin-import-x";
2
+
3
+ export default {
4
+ name: "@pob/eslint-config/node",
5
+ settings: {
6
+ "import-x/resolver-next": [
7
+ createNodeResolver({
8
+ extensions: [".mjs", ".js", ".json", ".ts"],
9
+ conditionNames: ["node", "import"],
10
+ }),
11
+ ],
12
+ },
13
+ rules: {
14
+ // ensure deprecated eslint rules are disabled
15
+ "callback-return": "off",
16
+ "global-require": "off",
17
+ "handle-callback-err": "off",
18
+ "no-mixed-requires": "off",
19
+ "no-new-require": "off",
20
+ "no-path-concat": "off",
21
+ "no-process-env": "off",
22
+ "no-process-exit": "off",
23
+ "no-restricted-modules": "off",
24
+ "no-sync": "off",
25
+ },
26
+ };
@@ -0,0 +1,61 @@
1
+ import { createNodeResolver } from "eslint-plugin-import-x";
2
+
3
+ export default {
4
+ name: "@pob/eslint-config/typescript",
5
+ languageOptions: {
6
+ parserOptions: {
7
+ project: true,
8
+ },
9
+ },
10
+ settings: {
11
+ "import-x/resolver-next": [
12
+ createNodeResolver({
13
+ extensions: [".mjs", ".js", ".json", ".ts"],
14
+ conditionNames: ["import"],
15
+ }),
16
+ ],
17
+ "import-x/extensions": [".js", ".mjs", ".ts", ".d.ts"],
18
+ },
19
+ rules: {
20
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/import/no-anonymous-default-export.md
21
+ // Reports if a module's default export is unnamed
22
+ "import-x/no-anonymous-default-export": [
23
+ "error",
24
+ {
25
+ allowArray: true,
26
+ allowArrowFunction: false,
27
+ allowAnonymousClass: false,
28
+ allowAnonymousFunction: false,
29
+ allowCallExpression: true,
30
+ allowLiteral: true,
31
+ allowObject: true,
32
+ },
33
+ ],
34
+
35
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/import/extensions.md
36
+ "import-x/extensions": [
37
+ "error",
38
+ "always",
39
+ {
40
+ ignorePackages: true,
41
+ pattern: {
42
+ js: "always",
43
+ cjs: "always",
44
+ mjs: "always",
45
+ cts: "always",
46
+ mts: "always",
47
+ ts: "always",
48
+ },
49
+ },
50
+ ],
51
+
52
+ /* issues */
53
+
54
+ // http://eslint.org/docs/rules/spaced-comment
55
+ // conflicts with typescript triple slash
56
+ "spaced-comment": "off",
57
+
58
+ /* some exported type doesnt work. tsc check that anyway */
59
+ "import-x/named": "off",
60
+ },
61
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pob/eslint-config",
3
- "version": "64.2.0",
3
+ "version": "65.0.0",
4
4
  "description": "eslint config files",
5
5
  "keywords": [],
6
6
  "author": "Christophe Hurpeau <christophe@hurpeau.com> (http://christophe.hurpeau.com/)",
@@ -40,23 +40,36 @@
40
40
  "pob": {},
41
41
  "prettier": "@pob/root/prettier-config",
42
42
  "peerDependencies": {
43
- "eslint": "^9.39.1"
43
+ "eslint": "^9.39.1",
44
+ "typescript": ">=5.0.0 <6.0.0"
45
+ },
46
+ "peerDependenciesMeta": {
47
+ "typescript": {
48
+ "optional": true
49
+ }
44
50
  },
45
51
  "dependencies": {
46
52
  "@eslint/js": "^9.39.1",
47
53
  "@eslint/json": "^0.14.0",
48
54
  "@pob/eslint-plugin": "64.2.0",
55
+ "@typescript-eslint/eslint-plugin": "^8.43.0",
56
+ "@typescript-eslint/parser": "^8.43.0",
49
57
  "confusing-browser-globals": "^1.0.11",
50
58
  "eslint-plugin-import-x": "^4.16.1",
51
59
  "eslint-plugin-n": "^17.23.1",
52
60
  "eslint-plugin-regexp": "^2.10.0",
53
- "eslint-plugin-unicorn": "^62.0.0"
61
+ "eslint-plugin-unicorn": "^62.0.0",
62
+ "typescript-eslint": "^8.43.0"
54
63
  },
55
64
  "devDependencies": {
65
+ "@typescript-eslint/eslint-plugin": "8.43.0",
66
+ "@typescript-eslint/parser": "8.43.0",
56
67
  "eslint": "9.39.1",
57
68
  "eslint-plugin-import-x": "4.16.1",
58
69
  "eslint-plugin-n": "17.23.1",
59
70
  "eslint-plugin-regexp": "2.10.0",
60
- "eslint-plugin-unicorn": "62.0.0"
71
+ "eslint-plugin-unicorn": "62.0.0",
72
+ "typescript": "5.9.3",
73
+ "typescript-eslint": "8.43.0"
61
74
  }
62
75
  }