arui-presets-lint 8.4.0 → 9.0.0-beta.1

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.
Files changed (2) hide show
  1. package/eslint/index.js +124 -11
  2. package/package.json +13 -13
package/eslint/index.js CHANGED
@@ -1,14 +1,15 @@
1
+ /* eslint-disable max-lines */
2
+ const { rules: baseBestPracticesRules } = require('eslint-config-airbnb-base/rules/best-practices');
3
+ const { rules: baseErrorsRules } = require('eslint-config-airbnb-base/rules/errors');
4
+ const { rules: baseES6Rules } = require('eslint-config-airbnb-base/rules/es6');
5
+
1
6
  module.exports = {
2
7
  parser: '@typescript-eslint/parser',
3
- extends: [
4
- 'airbnb',
5
- 'airbnb-typescript',
6
- 'airbnb/hooks',
7
- 'plugin:@typescript-eslint/recommended',
8
- 'prettier',
9
- ],
8
+ extends: ['airbnb', 'airbnb/hooks', 'plugin:@typescript-eslint/recommended', 'prettier'],
10
9
  parserOptions: {
11
- project: './tsconfig.json',
10
+ projectService: {
11
+ defaultProject: 'tsconfig.json',
12
+ },
12
13
  ecmaVersion: 2022,
13
14
  sourceType: 'module',
14
15
  ecmaFeatures: {
@@ -33,12 +34,30 @@ module.exports = {
33
34
  settings: {
34
35
  'import/resolver': {
35
36
  node: {
36
- extensions: ['.ts', '.tsx', '.js', '.jsx'],
37
+ extensions: [
38
+ '.ts',
39
+ '.tsx',
40
+ '.js',
41
+ '.jsx',
42
+ '.json',
43
+ '.d.ts',
44
+ '.mjs',
45
+ '.mts',
46
+ 'cjs',
47
+ 'cts',
48
+ ],
37
49
  },
38
50
  },
39
51
  react: {
40
52
  version: 'detect',
41
53
  },
54
+ // Apply special parsing for TypeScript files
55
+ 'import/parsers': {
56
+ '@typescript-eslint/parser': ['.ts', '.tsx', '.d.ts', '.mts', '.cts'],
57
+ },
58
+ 'import/extensions': ['.js', '.mjs', '.jsx', '.ts', '.tsx', '.d.ts'],
59
+ // Resolve type definition packages
60
+ 'import/external-module-folders': ['node_modules', 'node_modules/@types'],
42
61
  },
43
62
  rules: {
44
63
  quotes: ['warn', 'single', { avoidEscape: true, allowTemplateLiterals: false }],
@@ -57,8 +76,10 @@ module.exports = {
57
76
  'no-use-before-define': 'off',
58
77
  'prefer-regex-literals': 'off',
59
78
 
60
- // code smell detection
79
+ // Code smell detection
61
80
  complexity: ['warn', 20],
81
+ 'max-params': ['warn', 5],
82
+ 'max-lines': ['warn', 300],
62
83
  'max-nested-callbacks': 'warn',
63
84
  'no-restricted-properties': [
64
85
  'error',
@@ -114,9 +135,12 @@ module.exports = {
114
135
  { default: 'array-simple', readonly: 'array-simple' },
115
136
  ],
116
137
  '@typescript-eslint/consistent-type-assertions': 'error',
138
+ 'no-array-constructor': 'off',
117
139
  '@typescript-eslint/no-array-constructor': 'error',
118
140
  '@typescript-eslint/no-empty-interface': 'error',
119
141
  '@typescript-eslint/no-shadow': 'warn',
142
+ 'no-unused-vars': 'off',
143
+ 'no-new-func': 'off',
120
144
  '@typescript-eslint/no-unused-vars': ['error', { ignoreRestSiblings: true }],
121
145
  '@typescript-eslint/no-unnecessary-type-assertion': 'error',
122
146
  '@typescript-eslint/no-use-before-define': [
@@ -137,6 +161,46 @@ module.exports = {
137
161
  fixMixedExportsWithInlineTypeSpecifier: true,
138
162
  },
139
163
  ],
164
+ 'no-return-await': 'off',
165
+ '@typescript-eslint/return-await': [
166
+ baseBestPracticesRules['no-return-await'],
167
+ 'in-try-catch',
168
+ ],
169
+ 'no-redeclare': 'off',
170
+ '@typescript-eslint/no-redeclare': baseBestPracticesRules['no-redeclare'],
171
+
172
+ 'no-unused-expressions': 'off',
173
+ '@typescript-eslint/no-unused-expressions': baseBestPracticesRules['no-unused-expressions'],
174
+
175
+ 'no-useless-constructor': 'off',
176
+ '@typescript-eslint/no-useless-constructor': baseES6Rules['no-useless-constructor'],
177
+
178
+ 'require-await': 'off',
179
+ '@typescript-eslint/require-await': baseBestPracticesRules['require-await'],
180
+
181
+ 'no-extra-parens': 'off',
182
+ '@typescript-eslint/no-extra-parens': baseErrorsRules['no-extra-parens'],
183
+
184
+ 'no-implied-eval': 'off',
185
+ '@typescript-eslint/no-implied-eval': baseBestPracticesRules['no-implied-eval'],
186
+
187
+ 'no-loss-of-precision': 'off',
188
+ '@typescript-eslint/no-loss-of-precision': baseErrorsRules['no-loss-of-precision'],
189
+
190
+ 'no-loop-func': 'off',
191
+ '@typescript-eslint/no-loop-func': baseBestPracticesRules['no-loop-func'],
192
+
193
+ 'no-magic-numbers': 'off',
194
+ '@typescript-eslint/no-magic-numbers': baseBestPracticesRules['no-magic-numbers'],
195
+
196
+ 'dot-notation': 'off',
197
+ '@typescript-eslint/dot-notation': baseBestPracticesRules['dot-notation'],
198
+
199
+ 'no-dupe-class-members': 'off',
200
+ '@typescript-eslint/no-dupe-class-members': baseES6Rules['no-dupe-class-members'],
201
+
202
+ 'no-empty-function': 'off',
203
+ '@typescript-eslint/no-empty-function': baseBestPracticesRules['no-empty-function'],
140
204
 
141
205
  // Imports, file extensions
142
206
  'import/no-extraneous-dependencies': [
@@ -152,6 +216,7 @@ module.exports = {
152
216
  'import/prefer-default-export': 'off',
153
217
  'import/no-unresolved': 'off',
154
218
  'import/extensions': 'off',
219
+ '@typescript-eslint/no-require-imports': 'off',
155
220
  'import/no-useless-path-segments': [
156
221
  'error',
157
222
  {
@@ -224,10 +289,58 @@ module.exports = {
224
289
  ],
225
290
  'import/consistent-type-specifier-style': ['error', 'prefer-inline'],
226
291
  'import/no-duplicates': ['error', { 'prefer-inline': true, considerQueryString: true }],
292
+
293
+ camelcase: 'off',
294
+ // The `@typescript-eslint/naming-convention` rule allows `leadingUnderscore` and `trailingUnderscore` settings. However, the existing `no-underscore-dangle` rule already takes care of this.
295
+ '@typescript-eslint/naming-convention': [
296
+ 'error',
297
+ // Allow camelCase variables (23.2), PascalCase variables (23.8), and UPPER_CASE variables (23.10)
298
+ {
299
+ selector: 'variable',
300
+ format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
301
+ },
302
+ // Allow camelCase functions (23.2), and PascalCase functions (23.8)
303
+ {
304
+ selector: 'function',
305
+ format: ['camelCase', 'PascalCase'],
306
+ },
307
+ // Airbnb recommends PascalCase for classes (23.3), and although Airbnb does not make TypeScript recommendations, we are assuming this rule would similarly apply to anything "type like", including interfaces, type aliases, and enums
308
+ {
309
+ selector: 'typeLike',
310
+ format: ['PascalCase'],
311
+ },
312
+ ],
227
313
  },
228
314
  overrides: [
229
315
  {
230
- files: ['*.{test,tests,spec}.{js,jsx,ts,tsx}'],
316
+ files: ['*.ts', '*.tsx', '*.mts', '*.cts'],
317
+ rules: {
318
+ // The following rules are enabled in Airbnb config, but are already checked (more thoroughly) by the TypeScript compiler
319
+ // Some of the rules also fail in TypeScript files, for example: https://github.com/typescript-eslint/typescript-eslint/issues/662#issuecomment-507081586
320
+ // Rules are inspired by: https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/configs/eslint-recommended.ts
321
+ 'constructor-super': 'off',
322
+ 'getter-return': 'off',
323
+ 'no-const-assign': 'off',
324
+ 'no-dupe-args': 'off',
325
+ 'no-dupe-keys': 'off',
326
+ 'no-func-assign': 'off',
327
+ 'no-import-assign': 'off',
328
+ 'no-new-symbol': 'off',
329
+ 'no-obj-calls': 'off',
330
+ 'no-setter-return': 'off',
331
+ 'no-this-before-super': 'off',
332
+ 'no-undef': 'off',
333
+ 'no-unreachable': 'off',
334
+ 'no-unsafe-negation': 'off',
335
+ 'valid-typeof': 'off',
336
+ // The following rules are enabled in Airbnb config, but are recommended to be disabled within TypeScript projects
337
+ // See: https://github.com/typescript-eslint/typescript-eslint/blob/13583e65f5973da2a7ae8384493c5e00014db51b/docs/linting/TROUBLESHOOTING.md#eslint-plugin-import
338
+ 'import/named': 'off',
339
+ 'import/no-named-as-default-member': 'off',
340
+ },
341
+ },
342
+ {
343
+ files: ['*.{test,tests,spec}.{js,jsx,ts,tsx,cjs,cts,mjs,mts}'],
231
344
  env: {
232
345
  node: true,
233
346
  jest: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arui-presets-lint",
3
- "version": "8.4.0",
3
+ "version": "9.0.0-beta.1",
4
4
  "description": "Config files for arui-apps",
5
5
  "author": "core-ds contributors",
6
6
  "license": "MIT",
@@ -9,26 +9,26 @@
9
9
  "@alfalab/stylelint-core-vars": "1.7.1",
10
10
  "@commitlint/cli": "18.4.4",
11
11
  "@commitlint/config-conventional": "18.4.4",
12
- "@typescript-eslint/eslint-plugin": "7.18.0",
13
- "@typescript-eslint/parser": "7.18.0",
14
- "eslint": "8.57.0",
12
+ "@typescript-eslint/eslint-plugin": "8.22.0",
13
+ "@typescript-eslint/parser": "8.22.0",
14
+ "eslint": "8.57.1",
15
15
  "eslint-config-airbnb": "19.0.4",
16
- "eslint-config-airbnb-typescript": "18.0.0",
17
- "eslint-config-prettier": "9.1.0",
16
+ "eslint-config-airbnb-base": "15.0.0",
17
+ "eslint-config-prettier": "10.0.1",
18
18
  "eslint-import-resolver-typescript": "3.6.3",
19
19
  "eslint-plugin-cypress": "3.6.0",
20
20
  "eslint-plugin-dirnames": "1.0.3",
21
21
  "eslint-plugin-import": "2.31.0",
22
22
  "eslint-plugin-jsx-a11y": "6.10.2",
23
- "eslint-plugin-react": "7.37.2",
24
- "eslint-plugin-react-hooks": "4.6.2",
23
+ "eslint-plugin-react": "7.37.4",
24
+ "eslint-plugin-react-hooks": "5.1.0",
25
25
  "eslint-plugin-simple-import-sort": "12.1.1",
26
26
  "eslint-plugin-unicorn": "56.0.1",
27
27
  "execa": "9.5.2",
28
28
  "kebab-case": "1.0.0",
29
- "lefthook": "1.8.4",
30
- "prettier": "3.3.3",
31
- "stylelint": "16.11.0"
29
+ "lefthook": "1.10.10",
30
+ "prettier": "3.4.2",
31
+ "stylelint": "16.14.1"
32
32
  },
33
33
  "engines": {
34
34
  "node": ">=18.12.0"
@@ -43,7 +43,7 @@
43
43
  "@semantic-release/release-notes-generator": "12.1.0",
44
44
  "react": "18.3.1",
45
45
  "semantic-release": "22.0.12",
46
- "typescript": "5.5.4"
46
+ "typescript": "5.7.3"
47
47
  },
48
48
  "scripts": {
49
49
  "test": "eslint-config-prettier ./eslint/index.js && yarn lint",
@@ -75,5 +75,5 @@
75
75
  "commitlint": {
76
76
  "extends": "./commitlint"
77
77
  },
78
- "packageManager": "yarn@4.5.3"
78
+ "packageManager": "yarn@4.6.0"
79
79
  }