@fullstacksjs/eslint-config 13.13.3 → 13.14.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
@@ -30,6 +30,7 @@ import { defineConfig } from '@fullstacksjs/eslint-config';
30
30
  export default defineConfig({
31
31
  typescript: {
32
32
  tsconfigRootDir: import.meta.dirname, // Recommended when using TypeScript
33
+ }
33
34
  });
34
35
  ```
35
36
 
@@ -182,7 +183,7 @@ import/no-deprecated
182
183
 
183
184
  ```js
184
185
  export default defineConfig({
185
- disableExpensiveRules: !process.env.CI || !process.env.HUSKY // Or anywhere you want
186
+ disableExpensiveRules: !process.env.CI || !process.env.HUSKY, // Or anywhere you want
186
187
  prettier: false // So you should run the formatter explicitly.
187
188
  });
188
189
  ```
@@ -6,12 +6,14 @@ Object.defineProperty(exports, "__esModule", {
6
6
 
7
7
  var _eslintPluginJest = _interopRequireDefault(require("eslint-plugin-jest"));
8
8
  var _globals = _interopRequireDefault(require("globals"));
9
+ var _conditions = require("../utils/conditions.js");
9
10
  var _globs = require("../utils/globs.js");
10
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
12
  /**
12
13
  * @param { import('../index.js').Options } options
13
14
  * @return { import('eslint').Linter.Config } */
14
- function jest() {
15
+ function jest(options = {}) {
16
+ const projectService = options.typescript && options.typescript.tsconfigRootDir && options.typescript.projectService;
15
17
  return {
16
18
  files: _globs.globs.test,
17
19
  plugins: {
@@ -37,6 +39,10 @@ function jest() {
37
39
  'jest/no-done-callback': 'warn',
38
40
  'jest/no-expect-resolves': 'off',
39
41
  'jest/no-export': 'error',
42
+ ...(0, _conditions.predicate)(projectService, {
43
+ 'jest/no-error-equal': 'error',
44
+ 'jest/no-unnecessary-assertion': 'warn'
45
+ }),
40
46
  'jest/no-hooks': 'off',
41
47
  'jest/no-interpolation-in-snapshots': 'error',
42
48
  'jest/no-jasmine-globals': 'off',
@@ -60,6 +66,7 @@ function jest() {
60
66
  'jest/prefer-inline-snapshots': 'off',
61
67
  'jest/prefer-lowercase-title': 'off',
62
68
  'jest/prefer-mock-promise-shorthand': 'warn',
69
+ 'jest/prefer-mock-return-shorthand': 'warn',
63
70
  'jest/prefer-snapshot-hint': 'warn',
64
71
  'jest/prefer-spy-on': 'off',
65
72
  'jest/prefer-strict-equal': 'off',
@@ -112,7 +112,7 @@ function react(options = {}) {
112
112
  '@eslint-react/no-unnecessary-key': 'warn',
113
113
  '@eslint-react/prefer-use-state-lazy-initialization': 'warn',
114
114
  '@eslint-react/prefer-destructuring-assignment': 'warn',
115
- '@eslint-react/hooks-extra/no-direct-set-state-in-use-effect': 'warn',
115
+ '@eslint-react/hooks-extra/no-direct-set-state-in-use-effect': 'off',
116
116
  '@eslint-react/naming-convention/component-name': 'warn',
117
117
  '@eslint-react/naming-convention/context-name': 'warn',
118
118
  '@eslint-react/naming-convention/filename-extension': ['error', {
@@ -120,7 +120,11 @@ function react(options = {}) {
120
120
  extensions: ['.jsx', '.tsx']
121
121
  }],
122
122
  '@eslint-react/naming-convention/filename': 'off',
123
- '@eslint-react/naming-convention/use-state': 'off',
123
+ '@eslint-react/naming-convention/ref-name': 'warn',
124
+ '@eslint-react/naming-convention/use-state': ['warn', {
125
+ enforceAssignment: true,
126
+ enforceSetterName: false
127
+ }],
124
128
  '@eslint-react/web-api/no-leaked-timeout': 'error',
125
129
  '@eslint-react/web-api/no-leaked-event-listener': 'error',
126
130
  '@eslint-react/web-api/no-leaked-interval': 'error',
@@ -128,8 +128,7 @@ function typescript(options = {}) {
128
128
  classes: true
129
129
  }],
130
130
  '@typescript-eslint/no-useless-constructor': 'error',
131
- '@typescript-eslint/no-useless-default-assignment': 'off',
132
- // Re-enable after fix https://github.com/typescript-eslint/typescript-eslint/issues/11849
131
+ '@typescript-eslint/no-useless-default-assignment': 'warn',
133
132
  '@typescript-eslint/no-useless-empty-export': 'warn',
134
133
  '@typescript-eslint/parameter-properties': 'off',
135
134
  '@typescript-eslint/prefer-as-const': 'warn',
@@ -65,6 +65,7 @@ function vitest() {
65
65
  'vitest/no-standalone-expect': 'warn',
66
66
  'vitest/no-test-prefixes': 'warn',
67
67
  'vitest/no-test-return-statement': 'warn',
68
+ 'vitest/no-unneeded-async-expect-function': 'warn',
68
69
  'vitest/prefer-called-once': 'warn',
69
70
  'vitest/prefer-called-times': 'off',
70
71
  'vitest/prefer-called-with': 'warn',
@@ -79,6 +80,7 @@ function vitest() {
79
80
  'vitest/prefer-importing-vitest-globals': 'off',
80
81
  'vitest/prefer-lowercase-title': 'warn',
81
82
  'vitest/prefer-mock-promise-shorthand': 'warn',
83
+ 'vitest/prefer-mock-return-shorthand': 'warn',
82
84
  'vitest/prefer-snapshot-hint': 'warn',
83
85
  'vitest/prefer-spy-on': 'warn',
84
86
  'vitest/prefer-strict-boolean-matchers': 'off',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fullstacksjs/eslint-config",
3
- "version": "13.13.3",
3
+ "version": "13.14.0",
4
4
  "license": "MIT",
5
5
  "author": "fullstacks <fullstacksjs@gmail.com>",
6
6
  "description": "fullstacks eslint config",
@@ -37,28 +37,28 @@
37
37
  }
38
38
  },
39
39
  "dependencies": {
40
- "@eslint-react/eslint-plugin": "2.3.13",
40
+ "@eslint-react/eslint-plugin": "2.5.1",
41
41
  "@eslint/compat": "2.0.0",
42
- "@next/eslint-plugin-next": "16.0.10",
42
+ "@next/eslint-plugin-next": "16.1.1",
43
43
  "@stylistic/eslint-plugin": "5.6.1",
44
- "@vitest/eslint-plugin": "1.5.2",
44
+ "@vitest/eslint-plugin": "1.6.5",
45
45
  "deepmerge": "4.3.1",
46
46
  "eslint-plugin-better-tailwindcss": "3.8.0",
47
47
  "eslint-plugin-cypress": "5.2.0",
48
48
  "eslint-plugin-import-x": "4.16.1",
49
- "eslint-plugin-jest": "29.5.0",
49
+ "eslint-plugin-jest": "29.12.1",
50
50
  "eslint-plugin-jsx-a11y": "6.10.2",
51
51
  "eslint-plugin-n": "17.23.1",
52
- "eslint-plugin-perfectionist": "5.0.0",
52
+ "eslint-plugin-perfectionist": "5.2.0",
53
53
  "eslint-plugin-playwright": "2.4.0",
54
54
  "eslint-plugin-prettier": "5.5.4",
55
55
  "eslint-plugin-promise": "7.2.1",
56
56
  "eslint-plugin-react-hooks": "7.0.1",
57
57
  "eslint-plugin-regexp": "2.10.0",
58
- "eslint-plugin-storybook": "10.1.10",
59
- "globals": "16.5.0",
58
+ "eslint-plugin-storybook": "10.1.11",
59
+ "globals": "17.0.0",
60
60
  "local-pkg": "1.1.2",
61
- "typescript-eslint": "8.50.0"
61
+ "typescript-eslint": "8.51.0"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@eslint/eslintrc": "3.3.3",
@@ -75,7 +75,7 @@
75
75
  "pinst": "3.0.0",
76
76
  "prettier": "3.7.4",
77
77
  "semantic-release": "25.0.2",
78
- "storybook": "10.1.10",
78
+ "storybook": "10.1.11",
79
79
  "typescript": "5.9.3",
80
80
  "unbuild": "3.6.1"
81
81
  },
@@ -1,12 +1,15 @@
1
1
  import plugin from 'eslint-plugin-jest';
2
2
  import globals from 'globals';
3
3
 
4
+ import { predicate } from '../utils/conditions.mjs';
4
5
  import { globs } from '../utils/globs.mjs';
5
6
 
6
7
  /**
7
8
  * @param { import('..').Options } options
8
9
  * @return { import('eslint').Linter.Config } */
9
- function jest() {
10
+ function jest(options = {}) {
11
+ const projectService = options.typescript && options.typescript.tsconfigRootDir && options.typescript.projectService;
12
+
10
13
  return {
11
14
  files: globs.test,
12
15
  plugins: { jest: plugin },
@@ -28,6 +31,10 @@ function jest() {
28
31
  'jest/no-done-callback': 'warn',
29
32
  'jest/no-expect-resolves': 'off',
30
33
  'jest/no-export': 'error',
34
+ ...predicate(projectService, {
35
+ 'jest/no-error-equal': 'error',
36
+ 'jest/no-unnecessary-assertion': 'warn',
37
+ }),
31
38
  'jest/no-hooks': 'off',
32
39
  'jest/no-interpolation-in-snapshots': 'error',
33
40
  'jest/no-jasmine-globals': 'off',
@@ -49,6 +56,7 @@ function jest() {
49
56
  'jest/prefer-inline-snapshots': 'off',
50
57
  'jest/prefer-lowercase-title': 'off',
51
58
  'jest/prefer-mock-promise-shorthand': 'warn',
59
+ 'jest/prefer-mock-return-shorthand': 'warn',
52
60
  'jest/prefer-snapshot-hint': 'warn',
53
61
  'jest/prefer-spy-on': 'off',
54
62
  'jest/prefer-strict-equal': 'off',
@@ -110,13 +110,20 @@ function react(options = {}) {
110
110
  '@eslint-react/prefer-use-state-lazy-initialization': 'warn',
111
111
  '@eslint-react/prefer-destructuring-assignment': 'warn',
112
112
 
113
- '@eslint-react/hooks-extra/no-direct-set-state-in-use-effect': 'warn',
113
+ '@eslint-react/hooks-extra/no-direct-set-state-in-use-effect': 'off',
114
114
 
115
115
  '@eslint-react/naming-convention/component-name': 'warn',
116
116
  '@eslint-react/naming-convention/context-name': 'warn',
117
117
  '@eslint-react/naming-convention/filename-extension': ['error', { allow: 'always', extensions: ['.jsx', '.tsx'] }],
118
118
  '@eslint-react/naming-convention/filename': 'off',
119
- '@eslint-react/naming-convention/use-state': 'off',
119
+ '@eslint-react/naming-convention/ref-name': 'warn',
120
+ '@eslint-react/naming-convention/use-state': [
121
+ 'warn',
122
+ {
123
+ enforceAssignment: true,
124
+ enforceSetterName: false,
125
+ },
126
+ ],
120
127
 
121
128
  '@eslint-react/web-api/no-leaked-timeout': 'error',
122
129
  '@eslint-react/web-api/no-leaked-event-listener': 'error',
@@ -117,7 +117,7 @@ function typescript(options = {}) {
117
117
  ],
118
118
  '@typescript-eslint/no-use-before-define': ['error', { functions: false, classes: true }],
119
119
  '@typescript-eslint/no-useless-constructor': 'error',
120
- '@typescript-eslint/no-useless-default-assignment': 'off', // Re-enable after fix https://github.com/typescript-eslint/typescript-eslint/issues/11849
120
+ '@typescript-eslint/no-useless-default-assignment': 'warn',
121
121
  '@typescript-eslint/no-useless-empty-export': 'warn',
122
122
  '@typescript-eslint/parameter-properties': 'off',
123
123
  '@typescript-eslint/prefer-as-const': 'warn',
@@ -58,6 +58,7 @@ function vitest() {
58
58
  'vitest/no-standalone-expect': 'warn',
59
59
  'vitest/no-test-prefixes': 'warn',
60
60
  'vitest/no-test-return-statement': 'warn',
61
+ 'vitest/no-unneeded-async-expect-function': 'warn',
61
62
 
62
63
  'vitest/prefer-called-once': 'warn',
63
64
  'vitest/prefer-called-times': 'off',
@@ -73,6 +74,7 @@ function vitest() {
73
74
  'vitest/prefer-importing-vitest-globals': 'off',
74
75
  'vitest/prefer-lowercase-title': 'warn',
75
76
  'vitest/prefer-mock-promise-shorthand': 'warn',
77
+ 'vitest/prefer-mock-return-shorthand': 'warn',
76
78
  'vitest/prefer-snapshot-hint': 'warn',
77
79
  'vitest/prefer-spy-on': 'warn',
78
80
  'vitest/prefer-strict-boolean-matchers': 'off',