@shelf/eslint-config 5.0.1 → 5.1.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/README.md CHANGED
@@ -22,28 +22,6 @@ export default [...tsConfig];
22
22
 
23
23
  ### Frontend
24
24
 
25
- #### JavaScript with React `eslint.config.js`
26
-
27
- ```js
28
- import feConfig from '@shelf/eslint-config/frontend';
29
-
30
- export default [
31
- ...feConfig,
32
- {
33
- settings: {
34
- react: {
35
- version: '16.7.0',
36
- },
37
- },
38
- rules: {
39
- "react/prop-types": "warn"
40
- }
41
- }
42
- ];
43
- ```
44
-
45
- #### TypeScript or TypeScript + Next `eslint.config.js`
46
-
47
25
  ```js
48
26
  import feTsConfig from '@shelf/eslint-config/frontend-typescript';
49
27
 
@@ -52,13 +30,10 @@ export default [
52
30
  {
53
31
  settings: {
54
32
  react: {
55
- version: '16.7.0',
33
+ version: 'detect',
56
34
  },
57
35
  },
58
- rules: {
59
- "react/prop-types": "warn"
60
- }
61
- }
36
+ },
62
37
  ];
63
38
  ```
64
39
 
package/base.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import jestFormatting from 'eslint-plugin-jest-formatting';
2
- import jsonFormat from 'eslint-plugin-json-format';
3
2
  import prettier from 'eslint-plugin-prettier';
4
3
  import jestPlugin from 'eslint-plugin-jest';
5
4
  import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
@@ -26,7 +25,6 @@ export default [
26
25
  eslintPluginPrettierRecommended,
27
26
  {
28
27
  plugins: {
29
- 'json-format': jsonFormat,
30
28
  prettier,
31
29
  '@stylistic/js': stylisticJs,
32
30
  },
package/common/env.js CHANGED
@@ -1,8 +1,6 @@
1
1
  import globals from 'globals';
2
- import jest from 'eslint-plugin-jest';
3
2
 
4
3
  export default {
5
4
  ...globals.jest,
6
- ...jest.environments.globals.globals,
7
5
  ...globals.node,
8
6
  };
@@ -1,6 +1,6 @@
1
- import node from 'eslint-plugin-node';
1
+ import node from 'eslint-plugin-n';
2
2
  import testingLibrary from 'eslint-plugin-testing-library';
3
- import {fixupPluginRules} from '@eslint/compat';
3
+ import {fixupConfigRules, fixupPluginRules} from '@eslint/compat';
4
4
  import tsParser from '@typescript-eslint/parser';
5
5
  import path from 'node:path';
6
6
  import {fileURLToPath} from 'node:url';
@@ -11,7 +11,15 @@ import overrides from './common/overrides.js';
11
11
  import youDontNeedLodash from './rules/you-dont-need-lodash.js';
12
12
  import typescriptRules from './rules/typescript.js';
13
13
  import consistentTypeImports from './rules/consistent-type-imports.js';
14
- import frontendConfig from './frontend.js';
14
+ import sonarjs from 'eslint-plugin-sonarjs';
15
+ import eslintConfigPrettier from 'eslint-config-prettier';
16
+ import baseConfig from './base.js';
17
+ import react from 'eslint-plugin-react';
18
+ import reactHooks from 'eslint-plugin-react-hooks';
19
+ import _import from 'eslint-plugin-import';
20
+ import globals from 'globals';
21
+ import env from './common/env.js';
22
+ import restrictedPackagesImport from './rules/restricted-packages-import.js';
15
23
 
16
24
  const __filename = fileURLToPath(import.meta.url);
17
25
  const __dirname = path.dirname(__filename);
@@ -28,18 +36,38 @@ const testingLibraryReact = {
28
36
  export default [
29
37
  ...compat.extends('plugin:you-dont-need-lodash-underscore/compatible'),
30
38
  ...tsEslint.configs.recommended,
31
- ...frontendConfig,
39
+ ...fixupConfigRules(compat.extends('plugin:react/recommended', 'plugin:react-hooks/recommended')),
40
+ sonarjs.configs.recommended,
41
+ eslintConfigPrettier,
42
+ ...baseConfig,
43
+ {
44
+ rules: {
45
+ ...restrictedPackagesImport,
46
+ 'no-console': 'error',
47
+ 'react-hooks/exhaustive-deps': 'error',
48
+ 'sonarjs/cognitive-complexity': ['error', 18],
49
+ '@stylistic/js/multiline-comment-style': 'off',
50
+ 'no-unreachable': 'error',
51
+ 'react/react-in-jsx-scope': 'off',
52
+ },
53
+ },
32
54
  testingLibraryReact,
33
55
  {
34
56
  plugins: {
57
+ react: fixupPluginRules(react),
58
+ 'react-hooks': fixupPluginRules(reactHooks),
59
+ import: fixupPluginRules(_import),
35
60
  '@typescript-eslint': tsEslint.plugin,
36
61
  node,
37
62
  'testing-library': fixupPluginRules(testingLibrary),
38
63
  },
39
64
 
40
65
  languageOptions: {
66
+ globals: {
67
+ ...env,
68
+ ...globals.browser,
69
+ },
41
70
  parser: tsParser,
42
-
43
71
  parserOptions: {
44
72
  ecmaFeatures: {
45
73
  jsx: true,
@@ -80,7 +108,6 @@ export default [
80
108
  overrides.noTSRulesWithJSON,
81
109
  {
82
110
  files: ['**/*.test.{ts,tsx,js}', '**/mocks.ts', '**/mock.js'],
83
-
84
111
  rules: {
85
112
  camelcase: 'off',
86
113
  'sonarjs/no-duplicate-string': 'off',
@@ -89,7 +116,6 @@ export default [
89
116
  },
90
117
  {
91
118
  files: ['**/*.styled.{ts,tsx}'],
92
-
93
119
  rules: {
94
120
  'sonarjs/no-nested-template-literals': 'off',
95
121
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shelf/eslint-config",
3
- "version": "5.0.1",
3
+ "version": "5.1.0",
4
4
  "description": "ESLint Config for Shelf Projects",
5
5
  "license": "MIT",
6
6
  "repository": "shelfio/eslint-config",
@@ -13,15 +13,14 @@
13
13
  "node": ">=8.10"
14
14
  },
15
15
  "scripts": {
16
- "test": "echo ok"
16
+ "test": "echo ok",
17
+ "prepare": "husky"
17
18
  },
18
19
  "files": [
19
20
  "common",
20
21
  "rules",
21
22
  "base.js",
22
- "frontend.js",
23
23
  "frontend-typescript.js",
24
- "meteor.js",
25
24
  "typescript.js"
26
25
  ],
27
26
  "main": "base.js",
@@ -34,39 +33,35 @@
34
33
  },
35
34
  "type": "module",
36
35
  "dependencies": {
37
- "@babel/eslint-parser": "7.26.8",
38
- "@babel/eslint-plugin": "7.25.9",
39
36
  "@eslint/compat": "1.2.6",
40
37
  "@eslint/eslintrc": "3.2.0",
41
38
  "@eslint/js": "9.20.0",
42
39
  "@stylistic/eslint-plugin-js": "2.13.0",
43
40
  "@types/eslint__js": "8.42.3",
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",
41
+ "@typescript-eslint/eslint-plugin": "8.26.0",
42
+ "@typescript-eslint/parser": "8.26.0",
43
+ "eslint-config-next": "15.2.3",
44
+ "eslint-config-prettier": "10.1.1",
48
45
  "eslint-plugin-babel": "5.3.1",
49
46
  "eslint-plugin-import": "2.31.0",
50
47
  "eslint-plugin-jest": "28.11.0",
51
48
  "eslint-plugin-jest-formatting": "3.1.0",
52
- "eslint-plugin-json-format": "2.0.1",
53
49
  "eslint-plugin-jsx": "0.1.0",
54
- "eslint-plugin-n": "17.15.1",
55
- "eslint-plugin-node": "11.1.0",
50
+ "eslint-plugin-n": "17.16.2",
56
51
  "eslint-plugin-prettier": "5.2.3",
57
52
  "eslint-plugin-react": "7.37.4",
58
- "eslint-plugin-react-hooks": "5.1.0",
53
+ "eslint-plugin-react-hooks": "5.2.0",
59
54
  "eslint-plugin-shelf-no-need-lodash-methods": "2.0.8",
60
55
  "eslint-plugin-sonarjs": "3.0.2",
61
56
  "eslint-plugin-testing-library": "7.1.1",
62
57
  "eslint-plugin-you-dont-need-lodash-underscore": "6.14.0",
63
58
  "globals": "15.15.0",
64
- "typescript-eslint": "8.24.1"
59
+ "typescript-eslint": "8.26.0"
65
60
  },
66
61
  "devDependencies": {
67
- "husky": "8.0.3",
68
- "lint-staged": "15.4.3",
69
- "prettier": "3.5.1"
62
+ "husky": "9.1.7",
63
+ "lint-staged": "15.5.0",
64
+ "prettier": "3.5.3"
70
65
  },
71
66
  "peerDependencies": {
72
67
  "eslint": "9.x",
package/typescript.js CHANGED
@@ -1,8 +1,7 @@
1
1
  import jestFormatting from 'eslint-plugin-jest-formatting';
2
- import jsonFormat from 'eslint-plugin-json-format';
3
2
  import prettier from 'eslint-plugin-prettier';
4
3
  import _import from 'eslint-plugin-import';
5
- import node from 'eslint-plugin-node';
4
+ import node from 'eslint-plugin-n';
6
5
  import {fixupPluginRules} from '@eslint/compat';
7
6
  import tsParser from '@typescript-eslint/parser';
8
7
  import path from 'node:path';
@@ -51,7 +50,6 @@ export default [
51
50
  {
52
51
  plugins: {
53
52
  'jest-formatting': jestFormatting,
54
- 'json-format': jsonFormat,
55
53
  prettier,
56
54
  import: fixupPluginRules(_import),
57
55
  node,
@@ -117,6 +115,13 @@ export default [
117
115
  requireReturnForObjectLiteral: true,
118
116
  },
119
117
  ],
118
+ 'id-length': [
119
+ 'warn',
120
+ {
121
+ min: 1,
122
+ max: 14
123
+ },
124
+ ],
120
125
  'no-unreachable': 'error',
121
126
  'require-await': 'error',
122
127
  ...youDontNeedLodash,
package/.husky/_/husky.sh DELETED
@@ -1,31 +0,0 @@
1
- #!/bin/sh
2
- if [ -z "$husky_skip_init" ]; then
3
- debug () {
4
- if [ "$HUSKY_DEBUG" = "1" ]; then
5
- echo "husky (debug) - $1"
6
- fi
7
- }
8
-
9
- readonly hook_name="$(basename "$0")"
10
- debug "starting $hook_name..."
11
-
12
- if [ "$HUSKY" = "0" ]; then
13
- debug "HUSKY env variable is set to 0, skipping hook"
14
- exit 0
15
- fi
16
-
17
- if [ -f ~/.huskyrc ]; then
18
- debug "sourcing ~/.huskyrc"
19
- . ~/.huskyrc
20
- fi
21
-
22
- export readonly husky_skip_init=1
23
- sh -e "$0" "$@"
24
- exitCode="$?"
25
-
26
- if [ $exitCode != 0 ]; then
27
- echo "husky - $hook_name hook exited with code $exitCode (error)"
28
- fi
29
-
30
- exit $exitCode
31
- fi
package/CHANGELOG.md DELETED
@@ -1,12 +0,0 @@
1
- ## 3.0.0
2
-
3
- Override recommended no explicit type any in tests
4
-
5
- ## 2.0.0
6
-
7
- Removed separate file for testing-library, added testing-library rules to `frontend-typescript.js`.
8
- Extended `frontend.js` in `frontend-typescript.js` and `frontend-typescript-vue.js`.
9
-
10
- ## 1.0.0
11
-
12
- Breaking changes of the eslint-config-prettier 8.0.0
package/frontend.js DELETED
@@ -1,71 +0,0 @@
1
- import { FlatCompat } from '@eslint/eslintrc';
2
- import { fixupConfigRules, fixupPluginRules } from "@eslint/compat";
3
- import react from "eslint-plugin-react";
4
- import _import from "eslint-plugin-import";
5
- import sonarjs from "eslint-plugin-sonarjs";
6
- import globals from "globals";
7
- import babelParser from "@babel/eslint-parser";
8
- import path from "node:path";
9
- import { fileURLToPath } from "node:url";
10
- import js from "@eslint/js";
11
- import reactHooks from 'eslint-plugin-react-hooks';
12
- import eslintConfigPrettier from 'eslint-config-prettier';
13
- import env from './common/env.js';
14
- import restrictedPackagesImport from './rules/restricted-packages-import.js';
15
- import baseConfig from './base.js';
16
-
17
-
18
- const __filename = fileURLToPath(import.meta.url);
19
- const __dirname = path.dirname(__filename);
20
- const compat = new FlatCompat({
21
- baseDirectory: __dirname,
22
- recommendedConfig: js.configs.recommended,
23
- });
24
-
25
- export default [...fixupConfigRules(compat.extends(
26
- "plugin:react/recommended",
27
- "plugin:react-hooks/recommended",
28
- )),
29
- sonarjs.configs.recommended,
30
- eslintConfigPrettier,
31
- ...baseConfig,
32
- {
33
- plugins: {
34
- react: fixupPluginRules(react),
35
- 'react-hooks': fixupPluginRules(reactHooks),
36
- import: fixupPluginRules(_import),
37
- },
38
-
39
- languageOptions: {
40
- globals: {
41
- ...globals.browser,
42
- ...env,
43
- },
44
-
45
- parser: babelParser,
46
- ecmaVersion: 5,
47
- sourceType: "commonjs",
48
-
49
- parserOptions: {
50
- ecmaFeatures: {
51
- jsx: true,
52
- },
53
- }
54
- },
55
-
56
- rules: {
57
- ...restrictedPackagesImport,
58
- "no-console": "error",
59
- "react-hooks/exhaustive-deps": "error",
60
- "sonarjs/cognitive-complexity": ["error", 18],
61
- "@stylistic/js/multiline-comment-style": "off",
62
- "no-unreachable": "error",
63
- "react/react-in-jsx-scope": "off",
64
- },
65
- }, {
66
- files: ["**/*.test.{ts,tsx}"],
67
-
68
- rules: {
69
- "sonarjs/no-duplicate-string": "off",
70
- },
71
- }];
package/meteor.js DELETED
@@ -1,71 +0,0 @@
1
- import { fixupConfigRules, fixupPluginRules } from "@eslint/compat";
2
- import babel from "@babel/eslint-plugin";
3
- import react from "eslint-plugin-react";
4
- import prettier from "eslint-plugin-prettier";
5
- import _import from "eslint-plugin-import";
6
- import globals from "globals";
7
- import babelParser from "@babel/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
- import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
13
- import importOrder from './rules/import-order.js';
14
- import paddingLineBetweenStatements from './rules/padding-line-between-statements.js';
15
- import stylisticJs from '@stylistic/eslint-plugin-js';
16
-
17
-
18
- const __filename = fileURLToPath(import.meta.url);
19
- const __dirname = path.dirname(__filename);
20
- const compat = new FlatCompat({
21
- baseDirectory: __dirname,
22
- recommendedConfig: js.configs.recommended,
23
- });
24
-
25
- export default [...fixupConfigRules(compat.extends(
26
- "plugin:react/recommended",
27
- )),
28
- eslintPluginPrettierRecommended,
29
- {
30
- plugins: {
31
- babel,
32
- react: fixupPluginRules(react),
33
- prettier,
34
- import: fixupPluginRules(_import),
35
- '@stylistic/js': stylisticJs,
36
- },
37
-
38
- languageOptions: {
39
- globals: {
40
- ...globals.node,
41
- ...globals.browser,
42
- ...globals.meteor,
43
- },
44
-
45
- parser: babelParser,
46
-
47
- parserOptions: {
48
- ecmaFeatures: {
49
- jsx: true,
50
- },
51
-
52
- allowImportExportEverywhere: false,
53
- codeFrame: false,
54
- },
55
- },
56
-
57
- rules: {
58
- "prettier/prettier": "error",
59
- ...importOrder,
60
- ...paddingLineBetweenStatements,
61
- "comma-dangle": "off",
62
- camelcase: "error",
63
- eqeqeq: ["error", "smart"],
64
- "new-cap": "error",
65
- "no-extend-native": "error",
66
- "no-use-before-define": ["error", "nofunc"],
67
- "@stylistic/js/multiline-comment-style": ["error", "separate-lines"],
68
- "no-unreachable": "error",
69
- "require-await": "error",
70
- },
71
- }];