eslint-config-seek 14.6.0 → 15.0.0-typescriptify-vitest-20251112052133

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
@@ -3,33 +3,47 @@
3
3
 
4
4
  # eslint-config-seek
5
5
 
6
- This package includes the shareable ESLint configuration used by [SEEK](https://github.com/seek-oss/).
6
+ [SEEK](https://github.com/seek-oss/)'s shareable ESLint configuration.
7
7
 
8
8
  ## Usage in sku and skuba Projects
9
9
 
10
10
  The easiest way to use this configuration is with [sku](https://github.com/seek-oss/sku) or [skuba](https://github.com/seek-oss/skuba).
11
+ Sku and skuba projects automatically use this ESLint configuration, so you don't need to do anything extra to enable it.
11
12
 
12
- **You don’t need to install it separately in sku and skuba projects.**
13
+ > [!NOTE]
14
+ > You don’t need to install this package in sku and skuba projects.
13
15
 
14
16
  ## Usage Outside of sku and skuba
15
17
 
16
- If you want to use this ESLint configuration in a project not built with sku or skuba, you can install it with following steps.
18
+ To use this ESLint configuration in a project not built with sku or skuba, first install this package as a dev dependency:
17
19
 
18
- First, install this package, and the necessary peer dependencies listed in this project's [package.json](package.json).
20
+ ```sh
21
+ npm install --save-dev eslint-config-seek
22
+ ```
19
23
 
20
- Then create a file named `eslint.config.js` with the following contents in the root folder of your project:
24
+ Next, export the configuration from your ESLint config file:
21
25
 
22
26
  ```js
27
+ // eslint.config.js
28
+
29
+ // CJS config
23
30
  module.exports = require('eslint-config-seek');
31
+
32
+ // ESM config
33
+ export { default } from 'eslint-config-seek';
24
34
  ```
25
35
 
26
- The default configuration includes support for React projects. For projects that are not based on React, the "base" configuration should be used instead:
36
+ This package provides multiple configuration entrypoints to support different projects.
27
37
 
28
- ```js
29
- module.exports = require('eslint-config-seek/base');
30
- ```
38
+ | Entrypoint | Project type |
39
+ | -------------------------------- | --------------- |
40
+ | `eslint-config-seek` | React + Jest |
41
+ | `eslint-config-seek/base` | No react + Jest |
42
+ | `eslint-config-seek/vitest` | React + Vitest |
43
+ | `eslint-config-seek/vitest/base` | No react + Jest |
31
44
 
32
- You can override the settings from `eslint-config-seek` by editing the `eslint.config.js` file. Learn more about [configuring ESLint](https://eslint.org/docs/latest/use/configure/) on the ESLint website.
45
+ You can extend your configuration from `eslint-config-seek` by editing the `eslint.config.js` file.
46
+ Learn more about [configuring ESLint](https://eslint.org/docs/latest/use/configure/) on the ESLint website.
33
47
 
34
48
  ## License
35
49
 
@@ -0,0 +1,20 @@
1
+ const require_shared = require('./shared-UHub-_oG.cjs');
2
+ const require_extensions = require('./extensions-vqCxaxgq.cjs');
3
+ let eslint_config = require("eslint/config");
4
+ let __vitest_eslint_plugin = require("@vitest/eslint-plugin");
5
+ __vitest_eslint_plugin = require_shared.__toESM(__vitest_eslint_plugin);
6
+
7
+ //#region src/vitest/base.ts
8
+ const allExtensions = [...require_extensions.js, ...require_extensions.ts];
9
+ var base_default = (0, eslint_config.defineConfig)([{ extends: [require_shared.shared_default] }, {
10
+ files: [`**/__tests__/**/*.{${allExtensions}}`, `**/*.@(spec|test).{${allExtensions}}`],
11
+ extends: [__vitest_eslint_plugin.default.configs.recommended]
12
+ }]);
13
+
14
+ //#endregion
15
+ Object.defineProperty(exports, 'base_default', {
16
+ enumerable: true,
17
+ get: function () {
18
+ return base_default;
19
+ }
20
+ });
package/dist/base.cjs ADDED
@@ -0,0 +1,19 @@
1
+ const require_shared = require('./shared-UHub-_oG.cjs');
2
+ const require_extensions = require('./extensions-vqCxaxgq.cjs');
3
+ let eslint_config = require("eslint/config");
4
+ let globals = require("globals");
5
+ globals = require_shared.__toESM(globals);
6
+ let eslint_plugin_jest = require("eslint-plugin-jest");
7
+ eslint_plugin_jest = require_shared.__toESM(eslint_plugin_jest);
8
+
9
+ //#region src/base.ts
10
+ const allExtensions = [...require_extensions.js, ...require_extensions.ts];
11
+ var base_default = (0, eslint_config.defineConfig)([{ extends: [require_shared.shared_default] }, {
12
+ files: [`**/__tests__/**/*.{${allExtensions}}`, `**/*.@(spec|test).{${allExtensions}}`],
13
+ plugins: { jest: eslint_plugin_jest.default },
14
+ extends: [eslint_plugin_jest.default.configs["flat/recommended"]],
15
+ languageOptions: { globals: { ...globals.default.jest } }
16
+ }]);
17
+
18
+ //#endregion
19
+ module.exports = base_default;
@@ -0,0 +1,5 @@
1
+ import * as eslint_config1 from "eslint/config";
2
+
3
+ //#region src/base.d.ts
4
+ declare const _default: eslint_config1.Config[];
5
+ export = _default;
@@ -0,0 +1,28 @@
1
+
2
+ //#region src/extensions.ts
3
+ const js = [
4
+ "js",
5
+ "cjs",
6
+ "mjs",
7
+ "jsx"
8
+ ];
9
+ const ts = [
10
+ "ts",
11
+ "cts",
12
+ "mts",
13
+ "tsx"
14
+ ];
15
+
16
+ //#endregion
17
+ Object.defineProperty(exports, 'js', {
18
+ enumerable: true,
19
+ get: function () {
20
+ return js;
21
+ }
22
+ });
23
+ Object.defineProperty(exports, 'ts', {
24
+ enumerable: true,
25
+ get: function () {
26
+ return ts;
27
+ }
28
+ });
@@ -0,0 +1,4 @@
1
+ const require_extensions = require('./extensions-vqCxaxgq.cjs');
2
+
3
+ exports.js = require_extensions.js;
4
+ exports.ts = require_extensions.ts;
@@ -0,0 +1,5 @@
1
+ //#region src/extensions.d.ts
2
+ declare const js: string[];
3
+ declare const ts: string[];
4
+ //#endregion
5
+ export { js, ts };
package/dist/index.cjs ADDED
@@ -0,0 +1,10 @@
1
+ const require_shared = require('./shared-UHub-_oG.cjs');
2
+ require('./extensions-vqCxaxgq.cjs');
3
+ const require_react = require('./react-DObSKJuV.cjs');
4
+ let eslint_config = require("eslint/config");
5
+
6
+ //#region src/index.ts
7
+ var src_default = (0, eslint_config.defineConfig)({ extends: [require_shared.shared_default, require_react.react_default] });
8
+
9
+ //#endregion
10
+ module.exports = src_default;
@@ -0,0 +1,5 @@
1
+ import * as eslint_config2 from "eslint/config";
2
+
3
+ //#region src/index.d.ts
4
+ declare const _default: eslint_config2.Config[];
5
+ export = _default;
@@ -0,0 +1,56 @@
1
+ const require_shared = require('./shared-UHub-_oG.cjs');
2
+ let eslint_config = require("eslint/config");
3
+ let globals = require("globals");
4
+ globals = require_shared.__toESM(globals);
5
+ let eslint_plugin_react = require("eslint-plugin-react");
6
+ eslint_plugin_react = require_shared.__toESM(eslint_plugin_react);
7
+ let eslint_plugin_react_hooks = require("eslint-plugin-react-hooks");
8
+ eslint_plugin_react_hooks = require_shared.__toESM(eslint_plugin_react_hooks);
9
+
10
+ //#region src/react.ts
11
+ const OFF = 0;
12
+ const ERROR = 2;
13
+ const reactRules = {
14
+ "react/prefer-es6-class": [ERROR, "always"],
15
+ "react/self-closing-comp": ERROR,
16
+ "react/jsx-pascal-case": ERROR,
17
+ "react-hooks/rules-of-hooks": ERROR,
18
+ "react-hooks/exhaustive-deps": ERROR,
19
+ "react/no-children-prop": ERROR,
20
+ "react/display-name": OFF,
21
+ "react/prop-types": OFF,
22
+ "react/jsx-curly-brace-presence": [ERROR, {
23
+ props: "never",
24
+ children: "ignore",
25
+ propElementValues: "always"
26
+ }]
27
+ };
28
+ var react_default = (0, eslint_config.defineConfig)([
29
+ eslint_plugin_react.default.configs.flat.recommended,
30
+ eslint_plugin_react.default.configs.flat["jsx-runtime"],
31
+ {
32
+ plugins: {
33
+ react: eslint_plugin_react.default,
34
+ "react-hooks": eslint_plugin_react_hooks.default
35
+ },
36
+ languageOptions: { globals: globals.default.browser },
37
+ settings: { react: { version: "detect" } },
38
+ rules: reactRules
39
+ },
40
+ {
41
+ files: ["**/*.tsx"],
42
+ rules: { "@typescript-eslint/no-unused-vars": [ERROR, {
43
+ argsIgnorePattern: "^_",
44
+ ignoreRestSiblings: true,
45
+ varsIgnorePattern: "^React$"
46
+ }] }
47
+ }
48
+ ]);
49
+
50
+ //#endregion
51
+ Object.defineProperty(exports, 'react_default', {
52
+ enumerable: true,
53
+ get: function () {
54
+ return react_default;
55
+ }
56
+ });
@@ -0,0 +1,264 @@
1
+ //#region rolldown:runtime
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
+ key = keys[i];
11
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
+ get: ((k) => from[k]).bind(null, key),
13
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
+ });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
+ value: mod,
20
+ enumerable: true
21
+ }) : target, mod));
22
+
23
+ //#endregion
24
+ const require_extensions = require('./extensions-vqCxaxgq.cjs');
25
+ let eslint_config = require("eslint/config");
26
+ let eslint_plugin_import_x = require("eslint-plugin-import-x");
27
+ eslint_plugin_import_x = __toESM(eslint_plugin_import_x);
28
+ let globals = require("globals");
29
+ globals = __toESM(globals);
30
+ let eslint_plugin_cypress = require("eslint-plugin-cypress");
31
+ eslint_plugin_cypress = __toESM(eslint_plugin_cypress);
32
+ let eslint_config_prettier = require("eslint-config-prettier");
33
+ eslint_config_prettier = __toESM(eslint_config_prettier);
34
+ let typescript_eslint = require("typescript-eslint");
35
+ typescript_eslint = __toESM(typescript_eslint);
36
+
37
+ //#region src/shared.ts
38
+ const OFF = 0;
39
+ const WARN = 1;
40
+ const ERROR = 2;
41
+ const baseRules = {
42
+ "no-console": ERROR,
43
+ "no-unexpected-multiline": ERROR,
44
+ "block-scoped-var": ERROR,
45
+ "default-case": ERROR,
46
+ "dot-notation": ERROR,
47
+ eqeqeq: [
48
+ ERROR,
49
+ "always",
50
+ { null: "ignore" }
51
+ ],
52
+ "guard-for-in": ERROR,
53
+ "no-alert": ERROR,
54
+ "no-caller": ERROR,
55
+ "no-div-regex": ERROR,
56
+ "no-else-return": ERROR,
57
+ "no-eval": ERROR,
58
+ "no-extend-native": ERROR,
59
+ "no-extra-bind": ERROR,
60
+ "no-fallthrough": ERROR,
61
+ "no-floating-decimal": ERROR,
62
+ "no-implicit-coercion": ERROR,
63
+ "no-implied-eval": ERROR,
64
+ "no-iterator": ERROR,
65
+ "no-labels": ERROR,
66
+ "no-lone-blocks": ERROR,
67
+ "no-loop-func": ERROR,
68
+ "no-multi-str": ERROR,
69
+ "no-new-func": ERROR,
70
+ "no-new-wrappers": ERROR,
71
+ "no-new": ERROR,
72
+ "no-octal-escape": ERROR,
73
+ "no-param-reassign": ERROR,
74
+ "no-proto": ERROR,
75
+ "no-return-assign": ERROR,
76
+ "no-script-url": ERROR,
77
+ "no-self-compare": ERROR,
78
+ "no-sequences": ERROR,
79
+ "no-throw-literal": ERROR,
80
+ "no-useless-call": ERROR,
81
+ "no-void": ERROR,
82
+ radix: ERROR,
83
+ "vars-on-top": ERROR,
84
+ yoda: ERROR,
85
+ strict: [ERROR, "never"],
86
+ "no-label-var": ERROR,
87
+ "no-shadow": ERROR,
88
+ "no-undef-init": ERROR,
89
+ "no-unused-vars": [ERROR, {
90
+ argsIgnorePattern: "^_",
91
+ ignoreRestSiblings: true
92
+ }],
93
+ "handle-callback-err": ERROR,
94
+ "no-new-require": ERROR,
95
+ "no-path-concat": ERROR,
96
+ "no-process-exit": ERROR,
97
+ "no-restricted-modules": ERROR,
98
+ "no-restricted-syntax": [
99
+ ERROR,
100
+ {
101
+ selector: "MethodDefinition[kind = \"get\"]",
102
+ message: "Custom getters can cause confusion, particularly if they throw errors. Remove the `get` syntax to specify a regular method instead."
103
+ },
104
+ {
105
+ selector: "MethodDefinition[kind = \"set\"]",
106
+ message: "Custom setters can cause confusion, particularly if they throw errors. Remove the `set` syntax to specify a regular method instead."
107
+ },
108
+ {
109
+ selector: "Property[kind = \"get\"]",
110
+ message: "Custom getters can cause confusion, particularly if they throw errors. Remove the `get` syntax to specify a regular property instead."
111
+ },
112
+ {
113
+ selector: "Property[kind = \"set\"]",
114
+ message: "Custom setters can cause confusion, particularly if they throw errors. Remove the `set` syntax to specify a regular property instead."
115
+ }
116
+ ],
117
+ "no-sync": ERROR,
118
+ "linebreak-style": [ERROR, "unix"],
119
+ "new-cap": ERROR,
120
+ "no-lonely-if": ERROR,
121
+ "no-nested-ternary": ERROR,
122
+ "no-unneeded-ternary": ERROR,
123
+ "spaced-comment": [ERROR, "always"],
124
+ "no-var": ERROR,
125
+ "object-shorthand": ERROR,
126
+ "prefer-const": ERROR,
127
+ "prefer-spread": ERROR,
128
+ "prefer-template": ERROR,
129
+ "no-return-await": OFF
130
+ };
131
+ const eslintConfigPrettierOverrideRules = { curly: [ERROR, "all"] };
132
+ const allExtensions = [...require_extensions.js, ...require_extensions.ts];
133
+ const settings = { "import-x/resolver": {
134
+ typescript: true,
135
+ node: true
136
+ } };
137
+ var shared_default = (0, eslint_config.defineConfig)([
138
+ { plugins: {
139
+ cypress: eslint_plugin_cypress.default,
140
+ "@typescript-eslint": typescript_eslint.default.plugin
141
+ } },
142
+ eslint_plugin_import_x.default.flatConfigs.typescript,
143
+ {
144
+ rules: eslint_plugin_import_x.default.flatConfigs.errors.rules,
145
+ files: [`**/*.{${require_extensions.js}}`]
146
+ },
147
+ {
148
+ rules: eslint_plugin_import_x.default.flatConfigs.warnings.rules,
149
+ files: [`**/*.{${require_extensions.js}}`]
150
+ },
151
+ {
152
+ languageOptions: {
153
+ globals: { ...globals.default.node },
154
+ parserOptions: {
155
+ requireConfigFile: false,
156
+ ecmaVersion: "latest",
157
+ sourceType: "module"
158
+ }
159
+ },
160
+ settings,
161
+ rules: baseRules
162
+ },
163
+ eslint_config_prettier.default,
164
+ {
165
+ languageOptions: {
166
+ globals: { ...globals.default.node },
167
+ parserOptions: {
168
+ requireConfigFile: false,
169
+ ecmaVersion: "latest",
170
+ sourceType: "module"
171
+ }
172
+ },
173
+ settings,
174
+ rules: eslintConfigPrettierOverrideRules
175
+ },
176
+ ...[...typescript_eslint.default.configs.recommended, ...typescript_eslint.default.configs.stylistic].map((config) => ({
177
+ ...config,
178
+ files: [`**/*.{${require_extensions.ts}}`]
179
+ })),
180
+ {
181
+ files: [`**/*.{${require_extensions.ts}}`],
182
+ languageOptions: {
183
+ parser: typescript_eslint.default.parser,
184
+ parserOptions: {
185
+ projectService: true,
186
+ warnOnUnsupportedTypeScriptVersion: false
187
+ }
188
+ },
189
+ settings,
190
+ rules: {
191
+ "@typescript-eslint/array-type": [ERROR, { default: "array-simple" }],
192
+ "@typescript-eslint/consistent-type-definitions": OFF,
193
+ "@typescript-eslint/no-unused-expressions": ERROR,
194
+ "@typescript-eslint/no-unused-vars": [ERROR, {
195
+ argsIgnorePattern: "^_",
196
+ ignoreRestSiblings: true
197
+ }],
198
+ "@typescript-eslint/no-use-before-define": OFF,
199
+ "@typescript-eslint/no-non-null-assertion": OFF,
200
+ "@typescript-eslint/ban-ts-comment": OFF,
201
+ "@typescript-eslint/no-explicit-any": OFF,
202
+ "@typescript-eslint/explicit-function-return-type": OFF,
203
+ "@typescript-eslint/naming-convention": [
204
+ WARN,
205
+ {
206
+ selector: "typeLike",
207
+ format: ["PascalCase"],
208
+ leadingUnderscore: "allow"
209
+ },
210
+ {
211
+ selector: "enum",
212
+ format: null
213
+ }
214
+ ],
215
+ "@typescript-eslint/no-empty-function": OFF,
216
+ "@typescript-eslint/no-empty-interface": OFF,
217
+ "@typescript-eslint/no-inferrable-types": [ERROR, { ignoreParameters: true }],
218
+ "default-case": OFF,
219
+ "arrow-body-style": [ERROR, "as-needed"],
220
+ "no-shadow": OFF,
221
+ "@typescript-eslint/no-shadow": ERROR,
222
+ "@typescript-eslint/consistent-type-imports": [ERROR, { fixStyle: "inline-type-imports" }],
223
+ "@typescript-eslint/consistent-type-exports": [ERROR, { fixMixedExportsWithInlineTypeSpecifier: true }],
224
+ "@typescript-eslint/no-import-type-side-effects": ERROR,
225
+ "import-x/no-duplicates": [ERROR, { "prefer-inline": true }],
226
+ "import-x/export": ERROR
227
+ }
228
+ },
229
+ {
230
+ files: [`**/*.{${require_extensions.js}}`],
231
+ languageOptions: { globals: {} },
232
+ settings,
233
+ rules: {
234
+ "no-undef": ERROR,
235
+ "no-use-before-define": [ERROR, { functions: false }],
236
+ "no-unused-expressions": ERROR,
237
+ "import-x/no-unresolved": [ERROR, {
238
+ commonjs: true,
239
+ amd: true,
240
+ ignore: [".svg$", "^file?"]
241
+ }],
242
+ "import-x/no-duplicates": ERROR,
243
+ "import-x/export": ERROR
244
+ }
245
+ },
246
+ {
247
+ ...eslint_plugin_cypress.default.configs.recommended,
248
+ files: [`**/cypress/**/*.{${allExtensions}}`]
249
+ }
250
+ ]);
251
+
252
+ //#endregion
253
+ Object.defineProperty(exports, '__toESM', {
254
+ enumerable: true,
255
+ get: function () {
256
+ return __toESM;
257
+ }
258
+ });
259
+ Object.defineProperty(exports, 'shared_default', {
260
+ enumerable: true,
261
+ get: function () {
262
+ return shared_default;
263
+ }
264
+ });
@@ -0,0 +1,5 @@
1
+ require('../shared-UHub-_oG.cjs');
2
+ require('../extensions-vqCxaxgq.cjs');
3
+ const require_base = require('../base-DkGj8uSW.cjs');
4
+
5
+ module.exports = require_base.base_default;
@@ -0,0 +1,5 @@
1
+ import * as eslint_config0 from "eslint/config";
2
+
3
+ //#region src/vitest/base.d.ts
4
+ declare const _default: eslint_config0.Config[];
5
+ export = _default;
@@ -0,0 +1,11 @@
1
+ const require_shared = require('../shared-UHub-_oG.cjs');
2
+ require('../extensions-vqCxaxgq.cjs');
3
+ const require_react = require('../react-DObSKJuV.cjs');
4
+ const require_base = require('../base-DkGj8uSW.cjs');
5
+ let eslint_config = require("eslint/config");
6
+
7
+ //#region src/vitest/index.ts
8
+ var vitest_default = (0, eslint_config.defineConfig)({ extends: [require_base.base_default, require_react.react_default] });
9
+
10
+ //#endregion
11
+ module.exports = vitest_default;
@@ -0,0 +1,5 @@
1
+ import * as eslint_config0 from "eslint/config";
2
+
3
+ //#region src/vitest/index.d.ts
4
+ declare const _default: eslint_config0.Config[];
5
+ export = _default;
package/package.json CHANGED
@@ -1,13 +1,8 @@
1
1
  {
2
2
  "name": "eslint-config-seek",
3
- "version": "14.6.0",
3
+ "version": "15.0.0-typescriptify-vitest-20251112052133",
4
+ "type": "module",
4
5
  "description": "ESLint configuration used by SEEK",
5
- "main": "index.js",
6
- "files": [
7
- "index.js",
8
- "base.js",
9
- "extensions.js"
10
- ],
11
6
  "repository": {
12
7
  "type": "git",
13
8
  "url": "https://github.com/seek-oss/eslint-config-seek.git"
@@ -17,9 +12,23 @@
17
12
  "bugs": {
18
13
  "url": "https://github.com/seek-oss/eslint-config-seek/issues"
19
14
  },
15
+ "main": "./dist/index.cjs",
16
+ "types": "./dist/index.d.cts",
17
+ "exports": {
18
+ ".": "./dist/index.cjs",
19
+ "./base": "./dist/base.cjs",
20
+ "./extensions": "./dist/extensions.cjs",
21
+ "./vitest": "./dist/vitest/index.cjs",
22
+ "./vitest/base": "./dist/vitest/base.cjs",
23
+ "./package.json": "./package.json"
24
+ },
25
+ "files": [
26
+ "dist"
27
+ ],
20
28
  "homepage": "https://github.com/seek-oss/eslint-config-seek#readme",
21
29
  "dependencies": {
22
30
  "typescript-eslint": "^8.6.0",
31
+ "@vitest/eslint-plugin": "^1.4.2",
23
32
  "eslint-config-prettier": "^10.0.0",
24
33
  "eslint-import-resolver-typescript": "^4.0.0",
25
34
  "eslint-plugin-cypress": "^5.0.0",
@@ -32,23 +41,30 @@
32
41
  "devDependencies": {
33
42
  "@changesets/cli": "^2.27.7",
34
43
  "@changesets/get-github-info": "^0.6.0",
35
- "eslint": "^9.8.0",
44
+ "@tsconfig/node22": "^22.0.2",
45
+ "eslint": "^9.22.0",
46
+ "jiti": "^2.6.1",
36
47
  "prettier": "^3.3.3",
37
- "typescript": "~5.8.0"
48
+ "tsdown": "^0.16.3",
49
+ "typescript": "~5.9.0"
38
50
  },
39
51
  "peerDependencies": {
40
- "eslint": ">=9.9.1",
52
+ "eslint": ">=9.22.0",
41
53
  "typescript": ">=5.5.4"
42
54
  },
43
55
  "engines": {
44
- "node": ">=18.18.0"
45
- },
46
- "volta": {
47
- "node": "22.18.0"
56
+ "node": ">=22.21.1"
48
57
  },
49
58
  "scripts": {
50
- "release": "changeset publish",
51
- "test": "eslint --config index.js . && eslint --config base.js .",
52
- "changeset-version": "changeset version && prettier --write ."
59
+ "lint": "pnpm run '/^lint:.*/'",
60
+ "format": "pnpm run '/^format:.*/'",
61
+ "format:eslint": "eslint --fix .",
62
+ "format:prettier": "prettier --write .",
63
+ "lint:eslint": "eslint .",
64
+ "lint:tsc": "tsc --noEmit",
65
+ "build": "tsdown",
66
+ "lint:prettier": "prettier --check .",
67
+ "version": "changeset version && prettier --write .",
68
+ "release": "changeset publish"
53
69
  }
54
70
  }
package/base.js DELETED
@@ -1,292 +0,0 @@
1
- const importX = require('eslint-plugin-import-x');
2
- const globals = require('globals');
3
- const jestPlugin = require('eslint-plugin-jest');
4
- const cypress = require('eslint-plugin-cypress');
5
- const eslintConfigPrettier = require('eslint-config-prettier');
6
- const tseslint = require('typescript-eslint');
7
-
8
- const OFF = 0;
9
- const WARN = 1;
10
- const ERROR = 2;
11
-
12
- const baseRules = {
13
- // Possible Errors
14
- 'no-console': ERROR,
15
- 'no-unexpected-multiline': ERROR,
16
- 'block-scoped-var': ERROR,
17
- 'default-case': ERROR,
18
- 'dot-notation': ERROR,
19
- eqeqeq: [ERROR, 'always', { null: 'ignore' }],
20
- 'guard-for-in': ERROR,
21
- 'no-alert': ERROR,
22
- 'no-caller': ERROR,
23
- 'no-div-regex': ERROR,
24
- 'no-else-return': ERROR,
25
- 'no-eval': ERROR,
26
- 'no-extend-native': ERROR,
27
- 'no-extra-bind': ERROR,
28
- 'no-fallthrough': ERROR,
29
- 'no-floating-decimal': ERROR,
30
- 'no-implicit-coercion': ERROR,
31
- 'no-implied-eval': ERROR,
32
- 'no-iterator': ERROR,
33
- 'no-labels': ERROR,
34
- 'no-lone-blocks': ERROR,
35
- 'no-loop-func': ERROR,
36
- 'no-multi-str': ERROR,
37
- 'no-new-func': ERROR,
38
- 'no-new-wrappers': ERROR,
39
- 'no-new': ERROR,
40
- 'no-octal-escape': ERROR,
41
- 'no-param-reassign': ERROR,
42
- 'no-proto': ERROR,
43
- 'no-return-assign': ERROR,
44
- 'no-script-url': ERROR,
45
- 'no-self-compare': ERROR,
46
- 'no-sequences': ERROR,
47
- 'no-throw-literal': ERROR,
48
- 'no-useless-call': ERROR,
49
- 'no-void': ERROR,
50
- radix: ERROR,
51
- 'vars-on-top': ERROR,
52
- yoda: ERROR,
53
- strict: [ERROR, 'never'],
54
- 'no-label-var': ERROR,
55
- 'no-shadow': ERROR,
56
- 'no-undef-init': ERROR,
57
- 'no-unused-vars': [
58
- ERROR,
59
- { argsIgnorePattern: '^_', ignoreRestSiblings: true },
60
- ],
61
- 'handle-callback-err': ERROR,
62
- 'no-new-require': ERROR,
63
- 'no-path-concat': ERROR,
64
- 'no-process-exit': ERROR,
65
- 'no-restricted-modules': ERROR,
66
- 'no-restricted-syntax': [
67
- ERROR,
68
- {
69
- selector: 'MethodDefinition[kind = "get"]',
70
- message:
71
- 'Custom getters can cause confusion, particularly if they throw errors. Remove the `get` syntax to specify a regular method instead.',
72
- },
73
- {
74
- selector: 'MethodDefinition[kind = "set"]',
75
- message:
76
- 'Custom setters can cause confusion, particularly if they throw errors. Remove the `set` syntax to specify a regular method instead.',
77
- },
78
- {
79
- selector: 'Property[kind = "get"]',
80
- message:
81
- 'Custom getters can cause confusion, particularly if they throw errors. Remove the `get` syntax to specify a regular property instead.',
82
- },
83
- {
84
- selector: 'Property[kind = "set"]',
85
- message:
86
- 'Custom setters can cause confusion, particularly if they throw errors. Remove the `set` syntax to specify a regular property instead.',
87
- },
88
- ],
89
- 'no-sync': ERROR,
90
- 'linebreak-style': [ERROR, 'unix'],
91
- 'new-cap': ERROR,
92
- 'no-lonely-if': ERROR,
93
- 'no-nested-ternary': ERROR,
94
- 'no-unneeded-ternary': ERROR,
95
- 'spaced-comment': [ERROR, 'always'],
96
- 'no-var': ERROR,
97
- 'object-shorthand': ERROR,
98
- 'prefer-const': ERROR,
99
- 'prefer-spread': ERROR,
100
- 'prefer-template': ERROR,
101
- // Allow devs to choose between performance and richer stack traces
102
- // https://eslint.org/docs/rules/no-return-await#when-not-to-use-it
103
- // https://github.com/goldbergyoni/nodebestpractices/blob/master@%7B2022-01-01T00:00:00Z%7D/sections/errorhandling/returningpromises.md
104
- 'no-return-await': OFF,
105
- };
106
-
107
- const eslintConfigPrettierOverrideRules = {
108
- curly: [ERROR, 'all'],
109
- };
110
-
111
- const { js: jsExtensions, ts: tsExtensions } = require('./extensions');
112
- const allExtensions = [...jsExtensions, ...tsExtensions];
113
-
114
- const settings = {
115
- 'import-x/resolver': {
116
- typescript: true,
117
- node: true,
118
- },
119
- };
120
-
121
- module.exports = [
122
- {
123
- plugins: {
124
- jest: jestPlugin,
125
- cypress,
126
- '@typescript-eslint': tseslint.plugin,
127
- },
128
- },
129
- importX.flatConfigs.typescript,
130
- {
131
- rules: importX.flatConfigs.errors.rules,
132
- files: [`**/*.{${jsExtensions}}`],
133
- },
134
- {
135
- rules: importX.flatConfigs.warnings.rules,
136
- files: [`**/*.{${jsExtensions}}`],
137
- },
138
- {
139
- languageOptions: {
140
- globals: {
141
- ...globals.node,
142
- },
143
-
144
- parserOptions: {
145
- requireConfigFile: false,
146
- ecmaVersion: 'latest',
147
- sourceType: 'module',
148
- },
149
- },
150
- settings,
151
- rules: baseRules,
152
- },
153
- eslintConfigPrettier,
154
- {
155
- languageOptions: {
156
- globals: {
157
- ...globals.node,
158
- },
159
-
160
- parserOptions: {
161
- requireConfigFile: false,
162
- ecmaVersion: 'latest',
163
- sourceType: 'module',
164
- },
165
- },
166
- settings,
167
- rules: eslintConfigPrettierOverrideRules,
168
- },
169
- ...[...tseslint.configs.recommended, ...tseslint.configs.stylistic].map(
170
- ({ plugins, ...config }) => ({
171
- ...config,
172
- files: [`**/*.{${tsExtensions}}`],
173
- }),
174
- ),
175
- {
176
- files: [`**/*.{${tsExtensions}}`],
177
-
178
- languageOptions: {
179
- parser: tseslint.parser,
180
-
181
- parserOptions: {
182
- projectService: true,
183
- warnOnUnsupportedTypeScriptVersion: false,
184
- },
185
- },
186
- settings,
187
- rules: {
188
- '@typescript-eslint/array-type': [ERROR, { default: 'array-simple' }],
189
- '@typescript-eslint/consistent-type-definitions': OFF,
190
- '@typescript-eslint/no-unused-expressions': ERROR,
191
- '@typescript-eslint/no-unused-vars': [
192
- ERROR,
193
- { argsIgnorePattern: '^_', ignoreRestSiblings: true },
194
- ],
195
- '@typescript-eslint/no-use-before-define': OFF,
196
- '@typescript-eslint/no-non-null-assertion': OFF,
197
- '@typescript-eslint/ban-ts-comment': OFF,
198
- '@typescript-eslint/no-explicit-any': OFF,
199
- '@typescript-eslint/explicit-function-return-type': OFF,
200
- '@typescript-eslint/naming-convention': [
201
- // TODO - upgrade to ERROR in next major version
202
- WARN,
203
- {
204
- selector: 'typeLike',
205
- format: ['PascalCase'],
206
- leadingUnderscore: 'allow',
207
- },
208
- // 'typeLike' includes enums
209
- // This selector opts out of the rule for enums
210
- {
211
- selector: 'enum',
212
- format: null,
213
- },
214
- ],
215
- '@typescript-eslint/no-empty-function': OFF,
216
- '@typescript-eslint/no-empty-interface': OFF,
217
- '@typescript-eslint/no-inferrable-types': [
218
- ERROR,
219
- { ignoreParameters: true },
220
- ],
221
- // prefer TypeScript exhaustiveness checking
222
- // https://www.typescriptlang.org/docs/handbook/advanced-types.html#exhaustiveness-checking
223
- 'default-case': OFF,
224
- 'arrow-body-style': [ERROR, 'as-needed'],
225
- // Use `typescript-eslint`'s no-shadow to avoid false positives with enums
226
- // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/no-shadow.md
227
- 'no-shadow': OFF,
228
- '@typescript-eslint/no-shadow': ERROR,
229
-
230
- // These two rules deal with autofixing type imports/exports
231
- // https://typescript-eslint.io/rules/consistent-type-imports
232
- '@typescript-eslint/consistent-type-imports': [
233
- ERROR,
234
- { fixStyle: 'inline-type-imports' },
235
- ],
236
- // https://typescript-eslint.io/rules/consistent-type-exports
237
- '@typescript-eslint/consistent-type-exports': [
238
- ERROR,
239
- { fixMixedExportsWithInlineTypeSpecifier: true },
240
- ],
241
- // https://typescript-eslint.io/rules/no-import-type-side-effects
242
- '@typescript-eslint/no-import-type-side-effects': ERROR,
243
-
244
- // This rule deals with merging multiple imports from the same module.
245
- // In this case, we want type imports to be inlined when merging with the other imports.
246
- // However, there is a pending PR which improves the behaviour of this rule https://github.com/import-js/eslint-plugin-import/pull/2716
247
- // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-duplicates.md#inline-type-imports
248
- 'import-x/no-duplicates': [ERROR, { 'prefer-inline': true }],
249
- 'import-x/export': ERROR,
250
- },
251
- },
252
- {
253
- files: [`**/*.{${jsExtensions}}`],
254
- languageOptions: {
255
- globals: {},
256
- },
257
- settings,
258
- rules: {
259
- 'no-undef': ERROR,
260
- 'no-use-before-define': [ERROR, { functions: false }],
261
- 'no-unused-expressions': ERROR,
262
- 'import-x/no-unresolved': [
263
- ERROR,
264
- { commonjs: true, amd: true, ignore: ['.svg$', '^file?'] },
265
- ],
266
- 'import-x/no-duplicates': ERROR,
267
- 'import-x/export': ERROR,
268
- },
269
- },
270
- {
271
- ...jestPlugin.configs['flat/recommended'],
272
- files: [
273
- `**/__tests__/**/*.{${allExtensions}}`,
274
- `**/*.@(spec|test).{${allExtensions}}`,
275
- ],
276
- },
277
- {
278
- files: [
279
- `**/__tests__/**/*.{${allExtensions}}`,
280
- `**/*.@(spec|test).{${allExtensions}}`,
281
- ],
282
- languageOptions: {
283
- globals: {
284
- ...globals.jest,
285
- },
286
- },
287
- },
288
- {
289
- ...cypress.configs.recommended,
290
- files: [`**/cypress/**/*.{${allExtensions}}`],
291
- },
292
- ];
package/extensions.js DELETED
@@ -1,2 +0,0 @@
1
- module.exports.js = ['js', 'cjs', 'mjs', 'jsx'];
2
- module.exports.ts = ['ts', 'cts', 'mts', 'tsx'];
package/index.js DELETED
@@ -1,62 +0,0 @@
1
- const react = require('eslint-plugin-react');
2
- const reactHooks = require('eslint-plugin-react-hooks');
3
- const base = require('./base');
4
-
5
- const globals = require('globals');
6
-
7
- const OFF = 0;
8
- const ERROR = 2;
9
-
10
- const reactRules = {
11
- 'react/prefer-es6-class': [ERROR, 'always'],
12
- 'react/self-closing-comp': ERROR,
13
- 'react/jsx-pascal-case': ERROR,
14
- 'react-hooks/rules-of-hooks': ERROR,
15
- 'react-hooks/exhaustive-deps': ERROR,
16
- 'react/no-children-prop': ERROR,
17
- 'react/display-name': OFF,
18
- 'react/prop-types': OFF,
19
- 'react/jsx-curly-brace-presence': [
20
- ERROR,
21
- { props: 'never', children: 'ignore', propElementValues: 'always' },
22
- ],
23
- };
24
-
25
- module.exports = [
26
- react.configs.flat.recommended,
27
- react.configs.flat['jsx-runtime'],
28
- ...base,
29
- {
30
- plugins: {
31
- react,
32
- 'react-hooks': reactHooks,
33
- },
34
-
35
- languageOptions: {
36
- globals: globals.browser,
37
- },
38
-
39
- settings: {
40
- react: {
41
- version: 'detect',
42
- },
43
- },
44
-
45
- rules: reactRules,
46
- },
47
- {
48
- files: ['**/*.tsx'],
49
-
50
- rules: {
51
- // temporary override until everybody removes the React import
52
- '@typescript-eslint/no-unused-vars': [
53
- ERROR,
54
- {
55
- argsIgnorePattern: '^_',
56
- ignoreRestSiblings: true,
57
- varsIgnorePattern: '^React$',
58
- },
59
- ],
60
- },
61
- },
62
- ];