@smartive/eslint-config 7.0.1 → 7.0.2

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.
Files changed (3) hide show
  1. package/README.md +15 -0
  2. package/dist/configs.js +21 -4
  3. package/package.json +20 -10
package/README.md CHANGED
@@ -39,3 +39,18 @@ To use eslint add the following to your package.json:
39
39
  "lint:fix": "eslint {your source directory} --fix"
40
40
  }
41
41
  ```
42
+
43
+ ## Development
44
+
45
+ ```sh
46
+ $ npm run check-types # type-check the config sources
47
+ $ npm run prettier # formatting
48
+ $ npm test # build, type-check the tests, then run them
49
+ ```
50
+
51
+ The tests in `test/` lint the fixtures in `test/fixtures/` with each of the three rule sets and assert that
52
+ a given fixture line is flagged. They deliberately never assert on rule ids, so that swapping out a plugin
53
+ for an equivalent one does not require rewriting them.
54
+
55
+ > `npm test` runs the TypeScript test files directly through Node's type stripping, which needs Node
56
+ > 22.18 or newer.
package/dist/configs.js CHANGED
@@ -29,6 +29,18 @@ const baseConfig = {
29
29
  },
30
30
  },
31
31
  };
32
+ /**
33
+ * Type-aware rules cannot run on plain JavaScript.
34
+ *
35
+ * This has to come *after* every block that switches such a rule on — `typescriptRules` in
36
+ * `baseConfig` and `reactRules` both do — because in flat config the later block wins. Applied too
37
+ * early, ESLint fails with "You have used a rule which requires type information" on `.js` files.
38
+ */
39
+ const jsDisableTypeChecked = {
40
+ name: '@smartive/eslint-config/js-disable-type-checked',
41
+ files: ['**/*.js', '**/*.mjs'],
42
+ rules: tsEslint.configs.disableTypeChecked.rules,
43
+ };
32
44
  const reactConfig = { name: '@smartive/eslint-config/react', rules: reactRules };
33
45
  export const flatConfigTypescript = (rulesOnly = false) => defineConfig([
34
46
  js.configs.recommended,
@@ -36,6 +48,12 @@ export const flatConfigTypescript = (rulesOnly = false) => defineConfig([
36
48
  ...(rulesOnly
37
49
  ? [
38
50
  {
51
+ // `eslint-config-next` registers this plugin, but only for `**/*.ts` and `**/*.tsx`. Without
52
+ // registering it here, every `@typescript-eslint/*` rule reference — these, plus the ones in
53
+ // `typescriptRules` and `reactRules` — makes ESLint fail with `Could not find plugin` the
54
+ // moment a `.js` file is linted. Registering it twice is harmless: it is the same instance,
55
+ // since npm dedupes `typescript-eslint` between this package and `eslint-config-next`.
56
+ plugins: { '@typescript-eslint': tsEslint.plugin },
39
57
  rules: tsEslintConfigs.reduce((combinedRules, { rules }) => ({ ...combinedRules, ...(rules ? rules : {}) }), {}),
40
58
  },
41
59
  ]
@@ -56,11 +74,8 @@ export const flatConfigTypescript = (rulesOnly = false) => defineConfig([
56
74
  ...tsEslint.configs.recommendedTypeChecked,
57
75
  ...tsEslint.configs.stylisticTypeChecked,
58
76
  ]),
59
- {
60
- files: ['**/*.js', '**/*.mjs'],
61
- extends: [tsEslint.configs.disableTypeChecked],
62
- },
63
77
  baseConfig,
78
+ jsDisableTypeChecked,
64
79
  ]);
65
80
  export const flatConfigReact = () => defineConfig([
66
81
  ...flatConfigTypescript(),
@@ -68,9 +83,11 @@ export const flatConfigReact = () => defineConfig([
68
83
  reactPlugin.configs.flat['jsx-runtime'],
69
84
  reactHooks.configs.flat.recommended,
70
85
  reactConfig,
86
+ jsDisableTypeChecked,
71
87
  ]);
72
88
  export const flatConfigNext = () => defineConfig([
73
89
  ...createRequire(import.meta.url)('eslint-config-next/core-web-vitals'),
74
90
  ...flatConfigTypescript(true),
75
91
  reactConfig,
92
+ jsDisableTypeChecked,
76
93
  ]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartive/eslint-config",
3
- "version": "7.0.1",
3
+ "version": "7.0.2",
4
4
  "description": "ESLint configuration by smartive",
5
5
  "files": [
6
6
  "README.md",
@@ -52,31 +52,41 @@
52
52
  }
53
53
  },
54
54
  "devDependencies": {
55
- "@commitlint/cli": "20.4.1",
56
- "@commitlint/config-conventional": "20.4.1",
57
- "@eslint/js": "9.39.2",
55
+ "@commitlint/cli": "21.2.2",
56
+ "@commitlint/config-conventional": "21.2.2",
57
+ "@eslint/js": "9.39.5",
58
58
  "@smartive/prettier-config": "3.1.2",
59
- "@types/node": "24.10.12",
59
+ "@types/node": "25.9.5",
60
+ "@types/react": "19.2.18",
61
+ "@types/react-dom": "19.2.5",
60
62
  "cz-conventional-changelog": "3.3.0",
61
- "eslint": "9.39.2",
63
+ "eslint": "9.39.5",
64
+ "eslint-config-next": "16.3.4",
62
65
  "husky": "9.1.7",
63
- "prettier": "3.8.1",
64
- "typescript": "5.9.3"
66
+ "next": "16.3.4",
67
+ "prettier": "3.9.6",
68
+ "react": "19.2.8",
69
+ "react-dom": "19.2.8",
70
+ "typescript": "6.0.3"
65
71
  },
66
72
  "engines": {
67
73
  "node": "^20.19.0 || >=22.12"
68
74
  },
69
75
  "scripts": {
70
76
  "tsc": "tsc",
71
- "prettier": "prettier --check .",
77
+ "prettier": "prettier --check . --ignore-path .prettierignore-cli",
72
78
  "check-types": "tsc --noEmit",
73
79
  "build": "rm -rf dist && tsc",
74
80
  "commitlint": "commitlint --edit",
75
- "prepare": "[ ! -f node_modules/.bin/husky ] || husky"
81
+ "prepare": "[ ! -f node_modules/.bin/husky ] || husky",
82
+ "test": "npm run build && tsc --noEmit -p tsconfig.test.json && node --test \"test/**/*.test.ts\""
76
83
  },
77
84
  "config": {
78
85
  "commitizen": {
79
86
  "path": "./node_modules/cz-conventional-changelog"
80
87
  }
88
+ },
89
+ "allowScripts": {
90
+ "unrs-resolver@1.12.2": true
81
91
  }
82
92
  }