@nihalgonsalves/esconfig 0.10.26 → 0.11.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.
- package/README.md +1 -1
- package/eslint.config.react-shared.js +101 -1
- package/package.json +6 -1
- package/tsconfig.shared.json +13 -12
package/README.md
CHANGED
|
@@ -1,17 +1,29 @@
|
|
|
1
|
+
import vitest from "@vitest/eslint-plugin";
|
|
1
2
|
import prettierConfig from "eslint-config-prettier";
|
|
3
|
+
import jestDom from "eslint-plugin-jest-dom";
|
|
2
4
|
// @ts-expect-error no types
|
|
3
5
|
import jsxA11y from "eslint-plugin-jsx-a11y";
|
|
4
6
|
import react from "eslint-plugin-react";
|
|
7
|
+
import reactCompiler from "eslint-plugin-react-compiler";
|
|
5
8
|
import reactHooks from "eslint-plugin-react-hooks";
|
|
9
|
+
import storybook from "eslint-plugin-storybook";
|
|
10
|
+
import testingLibrary from "eslint-plugin-testing-library";
|
|
6
11
|
import tseslint from "typescript-eslint";
|
|
7
12
|
|
|
8
13
|
import sharedConfig from "./eslint.config.shared.js";
|
|
9
14
|
|
|
10
15
|
export default tseslint.config(
|
|
11
16
|
...sharedConfig,
|
|
17
|
+
{
|
|
18
|
+
ignores: [
|
|
19
|
+
// https://github.com/storybookjs/eslint-plugin-storybook?tab=readme-ov-file#installation
|
|
20
|
+
"!**/*/.storybook",
|
|
21
|
+
],
|
|
22
|
+
},
|
|
12
23
|
// @ts-expect-error wrong types
|
|
13
24
|
react.configs.flat.recommended,
|
|
14
25
|
react.configs.flat["jsx-runtime"],
|
|
26
|
+
reactCompiler.configs.recommended,
|
|
15
27
|
{
|
|
16
28
|
plugins: {
|
|
17
29
|
"react-hooks": reactHooks,
|
|
@@ -22,6 +34,41 @@ export default tseslint.config(
|
|
|
22
34
|
react: { version: "detect" },
|
|
23
35
|
},
|
|
24
36
|
rules: {
|
|
37
|
+
"no-restricted-globals": [
|
|
38
|
+
"error",
|
|
39
|
+
{
|
|
40
|
+
name: "React",
|
|
41
|
+
message: 'import { ... } from "react" instead',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: "location",
|
|
45
|
+
message:
|
|
46
|
+
"useLocation from your router package, or access window.location",
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
"no-restricted-imports": [
|
|
50
|
+
"error",
|
|
51
|
+
{
|
|
52
|
+
paths: [
|
|
53
|
+
{
|
|
54
|
+
name: "react",
|
|
55
|
+
importNames: ["default"],
|
|
56
|
+
message: 'import { ... } from "react" instead',
|
|
57
|
+
},
|
|
58
|
+
// TODO: https://eslint-react.xyz has dedicated rules
|
|
59
|
+
{
|
|
60
|
+
name: "react",
|
|
61
|
+
importNames: ["useContext"],
|
|
62
|
+
message: "Use `use()` instead",
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: "react",
|
|
66
|
+
importNames: ["forwardRef"],
|
|
67
|
+
message: "Use a prop instead",
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
},
|
|
71
|
+
],
|
|
25
72
|
"react/react-in-jsx-scope": "off",
|
|
26
73
|
"react/checked-requires-onchange-or-readonly": [
|
|
27
74
|
"off",
|
|
@@ -383,6 +430,59 @@ export default tseslint.config(
|
|
|
383
430
|
"jsx-a11y/tabindex-no-positive": "error",
|
|
384
431
|
},
|
|
385
432
|
},
|
|
386
|
-
|
|
433
|
+
...storybook.configs["flat/recommended"],
|
|
434
|
+
...storybook.configs["flat/addon-interactions"],
|
|
435
|
+
...storybook.configs["flat/csf-strict"],
|
|
436
|
+
{
|
|
437
|
+
files: [
|
|
438
|
+
"**/.storybook/**/*",
|
|
439
|
+
"**/*.test.@(ts|tsx|js|jsx|mjs|cjs)",
|
|
440
|
+
"**/*.stories.@(ts|tsx|js|jsx|mjs|cjs)",
|
|
441
|
+
],
|
|
442
|
+
extends: [
|
|
443
|
+
testingLibrary.configs["flat/react"],
|
|
444
|
+
vitest.configs.recommended,
|
|
445
|
+
jestDom.configs["flat/recommended"],
|
|
446
|
+
],
|
|
447
|
+
rules: {
|
|
448
|
+
"vitest/consistent-test-filename": "error",
|
|
449
|
+
"vitest/consistent-test-it": [
|
|
450
|
+
"error",
|
|
451
|
+
{ fn: "it", withinDescribe: "it" },
|
|
452
|
+
],
|
|
453
|
+
"vitest/no-focused-tests": "error",
|
|
454
|
+
"vitest/no-test-prefixes": "error",
|
|
455
|
+
"vitest/padding-around-after-all-blocks": "error",
|
|
456
|
+
"vitest/padding-around-after-each-blocks": "error",
|
|
457
|
+
"vitest/padding-around-before-all-blocks": "error",
|
|
458
|
+
"vitest/padding-around-before-each-blocks": "error",
|
|
459
|
+
"vitest/padding-around-describe-blocks": "error",
|
|
460
|
+
"vitest/padding-around-test-blocks": "error",
|
|
461
|
+
"vitest/prefer-comparison-matcher": "error",
|
|
462
|
+
"vitest/prefer-each": "error",
|
|
463
|
+
"vitest/prefer-equality-matcher": "error",
|
|
464
|
+
"vitest/prefer-expect-resolves": "error",
|
|
465
|
+
"vitest/prefer-hooks-in-order": "error",
|
|
466
|
+
"vitest/prefer-hooks-on-top": "error",
|
|
467
|
+
"vitest/prefer-mock-promise-shorthand": "error",
|
|
468
|
+
"vitest/prefer-strict-equal": "error",
|
|
469
|
+
"vitest/prefer-to-be": "error",
|
|
470
|
+
"vitest/prefer-to-be-object": "error",
|
|
471
|
+
"vitest/prefer-to-contain": "error",
|
|
472
|
+
"vitest/prefer-to-have-length": "error",
|
|
473
|
+
"vitest/prefer-todo": "error",
|
|
474
|
+
"vitest/prefer-vi-mocked": "error",
|
|
475
|
+
"vitest/require-to-throw-message": "error",
|
|
476
|
+
"vitest/valid-expect-in-promise": "error",
|
|
477
|
+
"vitest/expect-expect": "error",
|
|
478
|
+
},
|
|
479
|
+
},
|
|
480
|
+
{
|
|
481
|
+
files: ["**/.storybook/**/*", "**/*.stories.@(ts|tsx|js|jsx|mjs|cjs)"],
|
|
482
|
+
rules: {
|
|
483
|
+
"import/no-default-export": "off",
|
|
484
|
+
},
|
|
485
|
+
},
|
|
486
|
+
...storybook.configs.recommended.overrides,
|
|
387
487
|
prettierConfig,
|
|
388
488
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nihalgonsalves/esconfig",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.1",
|
|
4
4
|
"description": "Shared ECMAScript Config (TS, Lint, Prettier)",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": "git@github.com:nihalgonsalves/esconfig.git",
|
|
@@ -23,11 +23,16 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@eslint/js": "^9.22.0",
|
|
26
|
+
"@vitest/eslint-plugin": "^1.1.37",
|
|
26
27
|
"eslint-config-prettier": "^10.1.1",
|
|
27
28
|
"eslint-plugin-import": "^2.31.0",
|
|
29
|
+
"eslint-plugin-jest-dom": "^5.5.0",
|
|
28
30
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
29
31
|
"eslint-plugin-react": "^7.37.4",
|
|
32
|
+
"eslint-plugin-react-compiler": "19.0.0-beta-bafa41b-20250307",
|
|
30
33
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
34
|
+
"eslint-plugin-storybook": "^0.11.4",
|
|
35
|
+
"eslint-plugin-testing-library": "^7.1.1",
|
|
31
36
|
"typescript-eslint": "^8.26.0"
|
|
32
37
|
},
|
|
33
38
|
"devDependencies": {
|
package/tsconfig.shared.json
CHANGED
|
@@ -1,29 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"target": "
|
|
4
|
-
"module": "
|
|
3
|
+
"target": "ES2024",
|
|
4
|
+
"module": "Preserve",
|
|
5
5
|
"moduleResolution": "Bundler",
|
|
6
6
|
"moduleDetection": "force",
|
|
7
|
-
|
|
7
|
+
"strict": true,
|
|
8
8
|
"types": [],
|
|
9
9
|
|
|
10
|
-
"
|
|
11
|
-
"
|
|
10
|
+
"allowSyntheticDefaultImports": true,
|
|
11
|
+
"checkJs": true,
|
|
12
|
+
"erasableSyntaxOnly": true,
|
|
13
|
+
"esModuleInterop": true,
|
|
14
|
+
"exactOptionalPropertyTypes": true,
|
|
15
|
+
"forceConsistentCasingInFileNames": true,
|
|
12
16
|
"incremental": true,
|
|
13
|
-
|
|
17
|
+
"isolatedDeclarations": false,
|
|
14
18
|
"noFallthroughCasesInSwitch": true,
|
|
15
19
|
"noImplicitOverride": true,
|
|
16
20
|
"noImplicitReturns": true,
|
|
17
21
|
"noPropertyAccessFromIndexSignature": true,
|
|
18
22
|
"noUncheckedIndexedAccess": true,
|
|
23
|
+
"noUncheckedSideEffectImports": true,
|
|
19
24
|
"noUnusedLocals": true,
|
|
20
25
|
"noUnusedParameters": true,
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"allowSyntheticDefaultImports": true,
|
|
24
|
-
"esModuleInterop": true,
|
|
25
|
-
|
|
26
|
-
"forceConsistentCasingInFileNames": true,
|
|
26
|
+
"skipLibCheck": true,
|
|
27
|
+
"sourceMap": true,
|
|
27
28
|
"verbatimModuleSyntax": true
|
|
28
29
|
}
|
|
29
30
|
}
|