@shelf/eslint-config 4.3.0 → 5.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/base.js CHANGED
@@ -9,14 +9,16 @@ import jestRules from './rules/jest.js';
9
9
  import preferEs6 from './rules/prefer-es6.js';
10
10
  import importOrder from './rules/import-order.js';
11
11
  import sortImports from './rules/sort-imports.js';
12
- import stylisticJs from '@stylistic/eslint-plugin-js'
12
+ import stylisticJs from '@stylistic/eslint-plugin-js';
13
+ import comments from './rules/comments.js';
14
+ import overrides from './common/overrides.js';
13
15
 
14
16
  export default [
15
17
  {
16
18
  files: jestFormatting.configs.strict.overrides[0].files,
17
19
  rules: jestFormatting.configs.strict.overrides[0].rules,
18
20
  plugins: {
19
- "jest-formatting": jestFormatting,
21
+ 'jest-formatting': jestFormatting,
20
22
  },
21
23
  },
22
24
  jestPlugin.configs['flat/recommended'],
@@ -24,7 +26,7 @@ export default [
24
26
  eslintPluginPrettierRecommended,
25
27
  {
26
28
  plugins: {
27
- "json-format": jsonFormat,
29
+ 'json-format': jsonFormat,
28
30
  prettier,
29
31
  '@stylistic/js': stylisticJs,
30
32
  },
@@ -36,22 +38,27 @@ export default [
36
38
  },
37
39
 
38
40
  rules: {
39
- "prettier/prettier": "error",
41
+ 'prettier/prettier': 'error',
40
42
  ...paddingLineBetweenStatements,
41
43
  ...jestRules,
42
44
  ...preferEs6,
43
- "no-empty": ["error", {
44
- allowEmptyCatch: true,
45
- }],
45
+ 'no-empty': [
46
+ 'error',
47
+ {
48
+ allowEmptyCatch: true,
49
+ },
50
+ ],
46
51
  ...importOrder,
47
52
  ...sortImports,
48
- "comma-dangle": "off",
49
- camelcase: "error",
50
- eqeqeq: ["error", "smart"],
51
- "new-cap": "error",
52
- "no-extend-native": "error",
53
- "no-use-before-define": ["error", "nofunc"],
54
- "@stylistic/js/multiline-comment-style": ["error", "separate-lines"],
55
- "require-await": "error",
53
+ ...comments,
54
+ 'comma-dangle': 'off',
55
+ camelcase: 'error',
56
+ eqeqeq: ['error', 'smart'],
57
+ 'new-cap': 'error',
58
+ 'no-extend-native': 'error',
59
+ 'no-use-before-define': ['error', 'nofunc'],
60
+ '@stylistic/js/multiline-comment-style': ['error', 'separate-lines'],
61
+ 'require-await': 'error',
56
62
  },
57
- }];
63
+ },
64
+ ];
@@ -4,9 +4,9 @@ export default {
4
4
  // It's a bit annoying
5
5
  rules: {
6
6
  // There is no need to specify return types for test case function body it('...', fn)
7
- '@typescript-eslint/explicit-function-return-type': "off",
7
+ '@typescript-eslint/explicit-function-return-type': 'off',
8
8
  // There is no mandatory to specify types in tests
9
- '@typescript-eslint/no-explicit-any': "off",
9
+ '@typescript-eslint/no-explicit-any': 'off',
10
10
  },
11
11
  },
12
12
  allowRequireInConfigs: {
@@ -19,6 +19,13 @@ export default {
19
19
  ],
20
20
  rules: {
21
21
  '@typescript-eslint/no-var-requires': 'off',
22
+ '@typescript-eslint/no-require-imports': 'off',
23
+ },
24
+ },
25
+ noTSRulesWithJSON: {
26
+ files: ['*.json'],
27
+ rules: {
28
+ '@typescript-eslint/no-unused-expressions': 'off',
22
29
  },
23
30
  },
24
31
  noCastWithJestMock: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shelf/eslint-config",
3
- "version": "4.3.0",
3
+ "version": "5.0.0",
4
4
  "description": "ESLint Config for Shelf Projects",
5
5
  "license": "MIT",
6
6
  "repository": "shelfio/eslint-config",
@@ -34,38 +34,39 @@
34
34
  },
35
35
  "type": "module",
36
36
  "dependencies": {
37
- "@babel/eslint-parser": "7.25.1",
38
- "@babel/eslint-plugin": "7.25.1",
39
- "@eslint/compat": "1.1.0",
40
- "@eslint/eslintrc": "3.1.0",
41
- "@eslint/js": "9.6.0",
42
- "@stylistic/eslint-plugin-js": "2.6.1",
37
+ "@babel/eslint-parser": "7.26.8",
38
+ "@babel/eslint-plugin": "7.25.9",
39
+ "@eslint/compat": "1.2.6",
40
+ "@eslint/eslintrc": "3.2.0",
41
+ "@eslint/js": "9.20.0",
42
+ "@stylistic/eslint-plugin-js": "2.13.0",
43
43
  "@types/eslint__js": "8.42.3",
44
- "@typescript-eslint/eslint-plugin": "7.18.0",
45
- "@typescript-eslint/parser": "7.18.0",
46
- "eslint-config-next": "14.2.15",
47
- "eslint-config-prettier": "9.1.0",
44
+ "@typescript-eslint/eslint-plugin": "8.24.1",
45
+ "@typescript-eslint/parser": "8.24.1",
46
+ "eslint-config-next": "15.1.7",
47
+ "eslint-config-prettier": "10.0.1",
48
48
  "eslint-plugin-babel": "5.3.1",
49
49
  "eslint-plugin-import": "2.31.0",
50
- "eslint-plugin-jest": "28.8.3",
50
+ "eslint-plugin-jest": "28.11.0",
51
51
  "eslint-plugin-jest-formatting": "3.1.0",
52
52
  "eslint-plugin-json-format": "2.0.1",
53
53
  "eslint-plugin-jsx": "0.1.0",
54
- "eslint-plugin-n": "17.10.2",
55
- "eslint-plugin-prettier": "5.2.1",
56
- "eslint-plugin-react": "7.37.1",
57
- "eslint-plugin-react-hooks": "4.6.2",
54
+ "eslint-plugin-n": "17.15.1",
55
+ "eslint-plugin-node": "11.1.0",
56
+ "eslint-plugin-prettier": "5.2.3",
57
+ "eslint-plugin-react": "7.37.4",
58
+ "eslint-plugin-react-hooks": "5.1.0",
58
59
  "eslint-plugin-shelf-no-need-lodash-methods": "2.0.8",
59
- "eslint-plugin-sonarjs": "1.0.4",
60
- "eslint-plugin-testing-library": "6.3.0",
60
+ "eslint-plugin-sonarjs": "3.0.2",
61
+ "eslint-plugin-testing-library": "7.1.1",
61
62
  "eslint-plugin-you-dont-need-lodash-underscore": "6.14.0",
62
- "globals": "15.8.0",
63
- "typescript-eslint": "7.18.0"
63
+ "globals": "15.15.0",
64
+ "typescript-eslint": "8.24.1"
64
65
  },
65
66
  "devDependencies": {
66
67
  "husky": "8.0.3",
67
- "lint-staged": "15.3.0",
68
- "prettier": "3.3.3"
68
+ "lint-staged": "15.4.3",
69
+ "prettier": "3.5.1"
69
70
  },
70
71
  "peerDependencies": {
71
72
  "eslint": "9.x",
@@ -0,0 +1,5 @@
1
+ export default {
2
+ 'sonarjs/todo-tag': 'warn',
3
+ 'sonarjs/fixme-tag': 'warn',
4
+ 'sonarjs/no-commented-code': 'off',
5
+ };
@@ -3,4 +3,5 @@ export default {
3
3
  '@typescript-eslint/no-use-before-define': 'off',
4
4
  '@typescript-eslint/no-unused-vars': 'error',
5
5
  '@typescript-eslint/camelcase': 'off',
6
+ 'sonarjs/no-unused-vars': 'off', // @typescript-eslint/no-unused-vars handles it in more flexible way
6
7
  };
package/typescript.js CHANGED
@@ -1,14 +1,14 @@
1
- import jestFormatting from "eslint-plugin-jest-formatting";
2
- import jsonFormat from "eslint-plugin-json-format";
3
- import prettier from "eslint-plugin-prettier";
4
- import _import from "eslint-plugin-import";
5
- import node from "eslint-plugin-node";
6
- import { fixupPluginRules } from "@eslint/compat";
7
- import tsParser from "@typescript-eslint/parser";
8
- import path from "node:path";
9
- import { fileURLToPath } from "node:url";
10
- import js from "@eslint/js";
11
- import { FlatCompat } from "@eslint/eslintrc";
1
+ import jestFormatting from 'eslint-plugin-jest-formatting';
2
+ import jsonFormat from 'eslint-plugin-json-format';
3
+ import prettier from 'eslint-plugin-prettier';
4
+ import _import from 'eslint-plugin-import';
5
+ import node from 'eslint-plugin-node';
6
+ import {fixupPluginRules} from '@eslint/compat';
7
+ import tsParser from '@typescript-eslint/parser';
8
+ import path from 'node:path';
9
+ import {fileURLToPath} from 'node:url';
10
+ import js from '@eslint/js';
11
+ import {FlatCompat} from '@eslint/eslintrc';
12
12
  import tsEslint from 'typescript-eslint';
13
13
  import jestPlugin from 'eslint-plugin-jest';
14
14
  import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
@@ -27,7 +27,6 @@ import restrictedPackagesImport from './rules/restricted-packages-import.js';
27
27
  import overrides from './common/overrides.js';
28
28
  import stylisticJs from '@stylistic/eslint-plugin-js';
29
29
 
30
-
31
30
  const __filename = fileURLToPath(import.meta.url);
32
31
  const __dirname = path.dirname(__filename);
33
32
  const compat = new FlatCompat({
@@ -35,14 +34,14 @@ const compat = new FlatCompat({
35
34
  recommendedConfig: js.configs.recommended,
36
35
  });
37
36
 
38
- export default [...compat.extends(
39
- "plugin:you-dont-need-lodash-underscore/compatible",
40
- ), ...tsEslint.configs.recommended,
37
+ export default [
38
+ ...compat.extends('plugin:you-dont-need-lodash-underscore/compatible'),
39
+ ...tsEslint.configs.recommended,
41
40
  {
42
41
  files: jestFormatting.configs.strict.overrides[0].files,
43
42
  rules: jestFormatting.configs.strict.overrides[0].rules,
44
43
  plugins: {
45
- "jest-formatting": jestFormatting,
44
+ 'jest-formatting': jestFormatting,
46
45
  },
47
46
  },
48
47
  jestPlugin.configs['flat/recommended'],
@@ -51,8 +50,8 @@ export default [...compat.extends(
51
50
  shelfNoLodash.configs.all,
52
51
  {
53
52
  plugins: {
54
- "jest-formatting": jestFormatting,
55
- "json-format": jsonFormat,
53
+ 'jest-formatting': jestFormatting,
54
+ 'json-format': jsonFormat,
56
55
  prettier,
57
56
  import: fixupPluginRules(_import),
58
57
  node,
@@ -74,55 +73,69 @@ export default [...compat.extends(
74
73
  },
75
74
 
76
75
  settings: {
77
- "import/internal-regex": "^@shelf/",
76
+ 'import/internal-regex': '^@shelf/',
78
77
  },
79
78
 
80
79
  rules: {
81
- complexity: ["warn", {
82
- max: 5,
83
- }],
80
+ complexity: [
81
+ 'warn',
82
+ {
83
+ max: 5,
84
+ },
85
+ ],
84
86
 
85
- "multiline-ternary": ["error", "never"],
86
- curly: "error",
87
- "no-nested-ternary": "error",
88
- "prettier/prettier": "error",
87
+ 'multiline-ternary': ['error', 'never'],
88
+ curly: 'error',
89
+ 'no-nested-ternary': 'error',
90
+ 'prettier/prettier': 'error',
89
91
 
90
92
  ...paddingLineBetweenStatements,
91
93
  ...jestRules,
92
94
  ...preferEs6,
93
95
  ...importOrder,
94
96
  ...sortImports,
95
- "comma-dangle": "off",
97
+ 'comma-dangle': 'off',
96
98
  ...consistentTypeAssertions,
97
- camelcase: ["error", {
98
- properties: "never",
99
- ignoreGlobals: true,
100
- allow: ["hash_key", "range_key"],
101
- }],
102
- eqeqeq: ["error", "smart"],
103
- "new-cap": "error",
104
- "no-extend-native": "error",
105
- "no-use-before-define": "off",
99
+ camelcase: [
100
+ 'error',
101
+ {
102
+ properties: 'never',
103
+ ignoreGlobals: true,
104
+ allow: ['hash_key', 'range_key'],
105
+ },
106
+ ],
107
+ eqeqeq: ['error', 'smart'],
108
+ 'new-cap': 'error',
109
+ 'no-extend-native': 'error',
110
+ 'no-use-before-define': 'off',
106
111
  ...consistentTypeImports,
107
- "@stylistic/js/multiline-comment-style": ["error", "separate-lines"],
108
- "arrow-body-style": ["error", "as-needed", {
109
- requireReturnForObjectLiteral: true,
110
- }],
111
- "no-unreachable": "error",
112
- "require-await": "error",
112
+ '@stylistic/js/multiline-comment-style': ['error', 'separate-lines'],
113
+ 'arrow-body-style': [
114
+ 'error',
115
+ 'as-needed',
116
+ {
117
+ requireReturnForObjectLiteral: true,
118
+ },
119
+ ],
120
+ 'no-unreachable': 'error',
121
+ 'require-await': 'error',
113
122
  ...youDontNeedLodash,
114
- "@typescript-eslint/ban-ts-comment": "warn",
115
- "@typescript-eslint/no-non-null-assertion": "off",
123
+ '@typescript-eslint/ban-ts-comment': 'warn',
124
+ '@typescript-eslint/no-non-null-assertion': 'off',
116
125
  ...typescriptRules,
117
126
  ...restrictedPackagesImport,
118
- "@typescript-eslint/no-explicit-any": "warn",
119
- "no-restricted-syntax": ["error", {
120
- selector: "ObjectExpression > Property[key.name='accountId'] ~ SpreadElement",
121
- message: "Danger, this can overwrite 'accountId'. Rearrange the order.",
122
- }],
127
+ '@typescript-eslint/no-explicit-any': 'warn',
128
+ 'no-restricted-syntax': [
129
+ 'error',
130
+ {
131
+ selector: "ObjectExpression > Property[key.name='accountId'] ~ SpreadElement",
132
+ message: "Danger, this can overwrite 'accountId'. Rearrange the order.",
133
+ },
134
+ ],
123
135
  },
124
136
  },
125
137
  overrides.allowRequireInConfigs,
126
138
  overrides.noExplicitsInTests,
127
- overrides.noCastWithJestMock
139
+ overrides.noCastWithJestMock,
140
+ overrides.noTSRulesWithJSON,
128
141
  ];