@fullstacksjs/eslint-config 11.1.6 → 11.1.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fullstacksjs/eslint-config",
3
- "version": "11.1.6",
3
+ "version": "11.1.8",
4
4
  "license": "MIT",
5
5
  "author": "fullstacks <fullstacksjs@gmail.com>",
6
6
  "description": "fullstacks eslint config",
@@ -24,6 +24,7 @@
24
24
  },
25
25
  "main": "src/index.js",
26
26
  "dependencies": {
27
+ "@eslint-react/eslint-plugin": "1.5.15",
27
28
  "@graphql-eslint/eslint-plugin": "3.20.1",
28
29
  "deepmerge": "4.3.1",
29
30
  "eslint-import-resolver-typescript": "3.6.1",
@@ -37,12 +38,12 @@
37
38
  "eslint-plugin-playwright": "1.6.2",
38
39
  "eslint-plugin-prettier": "5.1.3",
39
40
  "eslint-plugin-promise": "6.2.0",
40
- "eslint-plugin-react": "7.34.2",
41
41
  "eslint-plugin-react-hooks": "4.6.2",
42
42
  "eslint-plugin-storybook": "0.8.0",
43
43
  "eslint-plugin-tailwindcss": "3.17.3",
44
44
  "eslint-plugin-vitest": "0.5.4",
45
45
  "globals": "15.4.0",
46
+ "local-pkg": "0.5.0",
46
47
  "typescript-eslint": "rc-v8"
47
48
  },
48
49
  "devDependencies": {
@@ -58,7 +59,6 @@
58
59
  "husky": "9.0.11",
59
60
  "jest": "29.7.0",
60
61
  "lint-staged": "15.2.5",
61
- "local-pkg": "0.5.0",
62
62
  "np": "10.0.0",
63
63
  "npm-run-all": "4.1.5",
64
64
  "pinst": "3.0.0",
package/src/init.d.ts CHANGED
@@ -15,7 +15,7 @@ export interface Options {
15
15
  storybook?: boolean;
16
16
  prettier?: boolean;
17
17
  playwright?: boolean;
18
- typescript?: { projects: string[] | string | boolean; tsconfigRootDir?: string };
18
+ typescript?: { projects: string[] | boolean | string; tsconfigRootDir?: string };
19
19
  disableExpensiveRules?: boolean;
20
20
  ignores?: string[];
21
21
  }
@@ -1,16 +1,13 @@
1
- const globals = require('globals');
2
1
  const plugin = require('eslint-plugin-jest');
3
- const { predicate } = require('../utils/conditions');
4
2
  const { globs } = require('../utils/globs');
5
3
 
6
4
  /**
7
5
  * @param { import('./init.d.ts').Options } options
8
6
  * @return { import('eslint').Linter.FlatConfig } */
9
- function jest(options = {}) {
7
+ function jest() {
10
8
  return {
11
9
  files: globs.test,
12
10
  plugins: { jest: plugin },
13
- languageOptions: { globals: globals.jest },
14
11
  rules: {
15
12
  'jest/consistent-test-it': 'off',
16
13
  'jest/expect-expect': 'off',
@@ -1,4 +1,3 @@
1
- const globals = require('globals');
2
1
  const plugin = require('eslint-plugin-playwright');
3
2
  const { globs } = require('../utils/globs');
4
3
 
@@ -1,4 +1,4 @@
1
- const reactPlugin = require('eslint-plugin-react');
1
+ const reactPlugin = require('@eslint-react/eslint-plugin');
2
2
  const hooksPlugin = require('eslint-plugin-react-hooks');
3
3
  const a11yPlugin = require('eslint-plugin-jsx-a11y');
4
4
 
@@ -6,10 +6,15 @@ const a11yPlugin = require('eslint-plugin-jsx-a11y');
6
6
  function react() {
7
7
  return {
8
8
  plugins: {
9
- 'react': reactPlugin,
9
+ ...reactPlugin.configs.all.plugins,
10
10
  'react-hooks': hooksPlugin,
11
11
  'jsx-a11y': a11yPlugin,
12
12
  },
13
+ languageOptions: {
14
+ globals: {
15
+ React: 'readonly',
16
+ },
17
+ },
13
18
  settings: {
14
19
  react: {
15
20
  pragma: 'React',
@@ -17,93 +22,64 @@ function react() {
17
22
  },
18
23
  },
19
24
  rules: {
20
- 'react/boolean-prop-naming': 'off',
21
- 'react/button-has-type': 'off',
22
- 'react/default-props-match-prop-types': 'off',
23
- 'react/destructuring-assignment': 'off',
24
- 'react/display-name': ['off', { ignoreTranspilerName: false }],
25
- 'react/forbid-component-props': 'off',
26
- 'react/forbid-dom-props': 'off',
27
- 'react/forbid-elements': 'off',
28
- 'react/forbid-foreign-prop-types': 'error',
29
- 'react/forbid-prop-types': 'off',
30
- 'react/function-component-definition': ['warn', { namedComponents: 'arrow-function', unnamedComponents: 'arrow-function' }],
31
- 'react/hook-use-state': 'off',
32
- 'react/iframe-missing-sandbox': 'error',
33
- 'react/jsx-boolean-value': 'warn',
34
- 'react/jsx-child-element-spacing': 'warn',
35
- 'react/jsx-curly-brace-presence': ['warn', { props: 'never', children: 'ignore' }],
36
- 'react/jsx-filename-extension': ['error', { extensions: ['.jsx', '.tsx'] }],
37
- 'react/jsx-fragments': 'off',
38
- 'react/jsx-handler-names': 'off',
39
- 'react/jsx-key': 'error',
40
- 'react/jsx-max-depth': 'off',
41
- 'react/jsx-newline': 'off',
42
- 'react/jsx-no-bind': 'off',
43
- 'react/jsx-no-comment-textnodes': 'error',
44
- 'react/jsx-no-constructed-context-values': 'error',
45
- 'react/jsx-no-duplicate-props': 'error',
46
- 'react/jsx-no-leaked-render': 'error',
47
- 'react/jsx-no-literals': 'off',
48
- 'react/jsx-no-script-url': 'error',
49
- 'react/jsx-no-target-blank': 'error',
50
- 'react/jsx-no-undef': 'error',
51
- 'react/jsx-no-useless-fragment': 'warn',
52
- 'react/jsx-one-expression-per-line': ['off', { allow: 'literal' }],
53
- 'react/jsx-pascal-case': 'error',
54
- 'react/jsx-props-no-multi-spaces': 'off',
55
- 'react/jsx-props-no-spreading': 'off',
56
- 'react/jsx-sort-props': 'off',
57
- 'react/jsx-uses-react': 'error',
58
- 'react/jsx-uses-vars': 'error',
59
- 'react/no-access-state-in-setstate': 'error',
60
- 'react/no-adjacent-inline-elements': 'error',
61
- 'react/no-array-index-key': 'warn',
62
- 'react/no-arrow-function-lifecycle': 'error',
63
- 'react/no-children-prop': 'off',
64
- 'react/no-danger': 'off',
65
- 'react/no-danger-with-children': 'error',
66
- 'react/no-deprecated': 'error',
67
- 'react/no-did-mount-set-state': 'error',
68
- 'react/no-did-update-set-state': 'error',
69
- 'react/no-direct-mutation-state': 'error',
70
- 'react/no-find-dom-node': 'error',
71
- 'react/no-invalid-html-attribute': 'warn',
72
- 'react/no-is-mounted': 'error',
73
- 'react/no-multi-comp': 'off',
74
- 'react/no-namespace': 'error',
75
- 'react/no-object-type-as-default-prop': 'warn',
76
- 'react/no-redundant-should-component-update': 'error',
77
- 'react/no-render-return-value': 'error',
78
- 'react/no-set-state': 'off',
79
- 'react/no-string-refs': 'error',
80
- 'react/no-this-in-sfc': 'error',
81
- 'react/no-typos': 'error',
82
- 'react/no-unescaped-entities': 'warn',
83
- 'react/no-unknown-property': 'error',
84
- 'react/no-unsafe': 'warn',
85
- 'react/no-unstable-nested-components': ['error', { allowAsProps: true }],
86
- 'react/no-unused-class-component-methods': 'warn',
87
- 'react/no-unused-prop-types': 'error',
88
- 'react/no-unused-state': 'error',
89
- 'react/no-will-update-set-state': 'error',
90
- 'react/prefer-es6-class': 'off',
91
- 'react/prefer-exact-props': 'off',
92
- 'react/prefer-read-only-props': 'off',
93
- 'react/prefer-stateless-function': 'off',
94
- 'react/prop-types': 'off',
95
- 'react/react-in-jsx-scope': 'off', // JSX automatic runtime
96
- 'react/require-default-props': 'off',
97
- 'react/require-optimization': 'off',
98
- 'react/require-render-return': 'error',
99
- 'react/self-closing-comp': 'error',
100
- 'react/sort-comp': 'off',
101
- 'react/sort-default-props': 'warn',
102
- 'react/sort-prop-types': 'off',
103
- 'react/state-in-constructor': 'off',
104
- 'react/static-property-placement': 'off',
105
- 'react/style-prop-object': 'error',
106
- 'react/void-dom-elements-no-children': 'error',
25
+ '@eslint-react/dom/no-children-in-void-dom-elements': 'warn',
26
+ '@eslint-react/dom/no-dangerously-set-innerhtml': 'warn',
27
+ '@eslint-react/dom/no-dangerously-set-innerhtml-with-children': 'error',
28
+ '@eslint-react/dom/no-find-dom-node': 'error',
29
+ '@eslint-react/dom/no-missing-button-type': 'warn',
30
+ '@eslint-react/dom/no-missing-iframe-sandbox': 'warn',
31
+ '@eslint-react/dom/no-namespace': 'error',
32
+ '@eslint-react/dom/no-render-return-value': 'error',
33
+ '@eslint-react/dom/no-script-url': 'warn',
34
+ '@eslint-react/dom/no-unsafe-iframe-sandbox': 'warn',
35
+ '@eslint-react/dom/no-unsafe-target-blank': 'warn',
36
+
37
+ '@eslint-react/ensure-forward-ref-using-ref': 'warn',
38
+ '@eslint-react/no-access-state-in-setstate': 'error',
39
+ '@eslint-react/no-array-index-key': 'warn',
40
+ '@eslint-react/no-children-count': 'warn',
41
+ '@eslint-react/no-children-for-each': 'warn',
42
+ '@eslint-react/no-children-map': 'warn',
43
+ '@eslint-react/no-children-only': 'warn',
44
+ '@eslint-react/no-children-prop': 'warn',
45
+ '@eslint-react/no-children-to-array': 'warn',
46
+ '@eslint-react/no-clone-element': 'warn',
47
+ '@eslint-react/no-comment-textnodes': 'warn',
48
+ '@eslint-react/no-component-will-mount': 'error',
49
+ '@eslint-react/no-component-will-receive-props': 'error',
50
+ '@eslint-react/no-component-will-update': 'error',
51
+ '@eslint-react/no-create-ref': 'error',
52
+ '@eslint-react/no-direct-mutation-state': 'error',
53
+ '@eslint-react/no-duplicate-key': 'error',
54
+ '@eslint-react/no-implicit-key': 'error',
55
+ '@eslint-react/no-missing-key': 'error',
56
+ '@eslint-react/no-nested-components': 'warn',
57
+ '@eslint-react/no-redundant-should-component-update': 'error',
58
+ '@eslint-react/no-set-state-in-component-did-mount': 'warn',
59
+ '@eslint-react/no-set-state-in-component-did-update': 'warn',
60
+ '@eslint-react/no-set-state-in-component-will-update': 'warn',
61
+ '@eslint-react/no-string-refs': 'error',
62
+ '@eslint-react/no-unsafe-component-will-mount': 'warn',
63
+ '@eslint-react/no-unsafe-component-will-receive-props': 'warn',
64
+ '@eslint-react/no-unsafe-component-will-update': 'warn',
65
+ '@eslint-react/no-unstable-context-value': 'error',
66
+ '@eslint-react/no-unstable-default-props': 'error',
67
+ '@eslint-react/no-unused-class-component-members': 'warn',
68
+ '@eslint-react/no-unused-state': 'warn',
69
+ '@eslint-react/no-useless-fragment': 'warn',
70
+ '@eslint-react/prefer-destructuring-assignment': 'warn',
71
+ '@eslint-react/prefer-shorthand-boolean': 'warn',
72
+ '@eslint-react/prefer-shorthand-fragment': 'warn',
73
+
74
+ '@eslint-react/hooks-extra/ensure-custom-hooks-using-other-hooks': 'warn',
75
+ '@eslint-react/hooks-extra/ensure-use-callback-has-non-empty-deps': 'warn',
76
+ '@eslint-react/hooks-extra/ensure-use-memo-has-non-empty-deps': 'warn',
77
+ '@eslint-react/hooks-extra/prefer-use-state-lazy-initialization': 'warn',
78
+
79
+ '@eslint-react/naming-convention/component-name': 'warn',
80
+ '@eslint-react/naming-convention/filename': 'warn',
81
+ '@eslint-react/naming-convention/filename-extension': 'warn',
82
+ '@eslint-react/naming-convention/use-state': 'warn',
107
83
 
108
84
  'react-hooks/exhaustive-deps': 'warn',
109
85
  'react-hooks/rules-of-hooks': 'error',
@@ -1,14 +1,11 @@
1
- const { predicate } = require('../utils/conditions');
2
-
3
1
  /**
4
2
  * @param {import('../init.d.ts').Options} options
5
3
  * @return { import('eslint').Linter.FlatConfig }
6
4
  */
7
- function strict(options = {}) {
5
+ function strict() {
8
6
  return {
9
7
  rules: {
10
8
  'no-console': 'warn',
11
- // ...predicate(options.typescript, { '@typescript-eslint/no-non-null-assertion': 'warn' }),
12
9
  },
13
10
  };
14
11
  }
@@ -1,7 +1,7 @@
1
- const plugin = require('eslint-plugin-tailwindcss');
2
-
3
1
  /** @return { Promise<import('eslint').Linter.FlatConfig> } */
4
2
  function tailwind() {
3
+ const plugin = require('eslint-plugin-tailwindcss');
4
+
5
5
  return {
6
6
  plugins: { tailwindcss: plugin },
7
7
  rules: {
@@ -1,7 +1,7 @@
1
1
  const plugin = require('eslint-plugin-jest-formatting');
2
+ const globals = require('globals');
2
3
  const { globs } = require('../utils/globs');
3
4
  const { predicate } = require('../utils/conditions');
4
- const globals = require('globals');
5
5
 
6
6
  /**
7
7
  * @param {import('../init').Options} options
@@ -12,7 +12,7 @@ function tests(options = {}) {
12
12
  plugins: { 'jest-formatting': plugin },
13
13
  files: [...globs.test, ...globs.e2e],
14
14
  languageOptions: {
15
- globals: globals['shared-node-browser'],
15
+ globals: { ...globals['shared-node-browser'], ...globals.jest },
16
16
  },
17
17
  rules: {
18
18
  'jest-formatting/padding-around-after-all-blocks': 'warn',
@@ -93,6 +93,7 @@ function typescript(options = {}) {
93
93
  '@typescript-eslint/no-non-null-asserted-nullish-coalescing': 'error',
94
94
  '@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
95
95
  '@typescript-eslint/no-non-null-assertion': 'off',
96
+ ...predicate(options.strict, { '@typescript-eslint/no-non-null-assertion': 'warn' }),
96
97
  '@typescript-eslint/no-redeclare': ['off', { ignoreDeclarationMerge: true }], // useful in FP.
97
98
  '@typescript-eslint/no-require-imports': 'error',
98
99
  '@typescript-eslint/no-restricted-imports': 'off',