@qlik/eslint-config 0.8.1 → 1.0.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.
Files changed (45) hide show
  1. package/README.md +137 -80
  2. package/package.json +37 -43
  3. package/src/configs/cjs.js +45 -0
  4. package/src/configs/esm.js +43 -0
  5. package/src/configs/jest.js +24 -0
  6. package/src/configs/playwright.js +19 -0
  7. package/src/configs/react.js +75 -0
  8. package/src/configs/recommended.js +64 -0
  9. package/src/configs/rules/eslint-core.js +970 -0
  10. package/src/configs/rules/import-x.js +159 -0
  11. package/src/configs/rules/index.js +17 -0
  12. package/src/configs/rules/node.js +10 -0
  13. package/src/configs/rules/react-a11y.js +232 -0
  14. package/src/configs/rules/react-hooks.js +16 -0
  15. package/src/configs/rules/react.js +479 -0
  16. package/src/configs/rules/svelte.js +11 -0
  17. package/src/configs/rules/testing-library.js +74 -0
  18. package/src/configs/rules/typescript.js +228 -0
  19. package/src/configs/svelte.js +48 -0
  20. package/src/configs/vitest.js +36 -0
  21. package/src/index.d.ts +24 -0
  22. package/src/index.js +29 -0
  23. package/src/types/index.ts +52 -0
  24. package/src/utils/compose.js +62 -0
  25. package/src/utils/config.js +22 -0
  26. package/src/utils/merge.js +28 -0
  27. package/configs/airbnb-base-mod.js +0 -77
  28. package/configs/airbnb-mod.js +0 -17
  29. package/configs/airbnb-ts-base-mod.js +0 -37
  30. package/configs/airbnb-ts-mod.js +0 -17
  31. package/configs/env.js +0 -11
  32. package/esm.js +0 -6
  33. package/index.js +0 -10
  34. package/jest.js +0 -25
  35. package/node.js +0 -10
  36. package/overrides/react.js +0 -27
  37. package/overrides/sveltejs.js +0 -25
  38. package/overrides/sveltets.js +0 -32
  39. package/overrides/ts.js +0 -23
  40. package/playwright.js +0 -12
  41. package/react-svelte.js +0 -6
  42. package/react.js +0 -3
  43. package/svelte-js.js +0 -6
  44. package/svelte.js +0 -6
  45. package/vitest.js +0 -13
package/README.md CHANGED
@@ -1,110 +1,167 @@
1
+ <!-- prettier-ignore-start -->
1
2
  # @qlik/eslint-config
2
3
 
3
- Qlik's ESlint config for pure javascript/typescript environments. Based on airbnb-base/prettier config with some modifications.
4
+ Qlik's ESlint config for JavaScript/TypeScript environments with optional framework support.
4
5
 
5
- ## usage
6
+ ## Migrating from 0.x
6
7
 
7
- These configs assumes that you are using typescript. It is still possible to write .js files and get linting on those.
8
+ 1. Install latest `@qlik/eslint-config`
9
+ 2. Update to ESLint 9
10
+ 3. Rename your config to `eslint.config.js` (if you have `"type": "module"` in your package json) / `eslint.config.mjs` (if otherwise)
8
11
 
9
- Simplest approach is to add one of the following field in `package.json`:
12
+ example config that uses typescript, react, vitest, react-query plugin:
10
13
 
11
- For a pure environment with no specific frameworks use:
14
+ ```js
15
+ // @ts-check
16
+ import qlik from "@qlik/eslint-config";
17
+ import pluginQuery from "@tanstack/eslint-plugin-query";
12
18
 
13
- ```json
14
- "eslintConfig": {
15
- "root": true,
16
- "parserOptions": {
17
- "project": "path/to/tsconfig.json"
19
+ export default qlik.compose(
20
+ ...qlik.configs.react,
21
+ ...qlik.configs.vitest,
22
+ ...pluginQuery.configs["flat/recommended"],
23
+ {
24
+ rules: {
25
+ // Override rules if needed
26
+ },
18
27
  },
19
- "extends": [
20
- "@qlik/eslint-config"
21
- ]
22
- },
28
+ // In its own object so it's global
29
+ {
30
+ ignores: ["dist", "node_modules", "script"],
31
+ },
32
+ );
23
33
  ```
24
34
 
25
- Using react:
35
+ 4. If you are not using typescript to build your project, then include all files `"include": [".*", "**/*"]` in the project's `tsconfig.json`
36
+ 5. Run your `lint` script
26
37
 
27
- ```json
28
- "eslintConfig": {
29
- "root": true,
30
- "parserOptions": {
31
- "project": "path/to/tsconfig.json"
32
- },
33
- "extends": [
34
- "@qlik/eslint-config/react"
35
- ]
36
- },
38
+ ### v1 notable changes
39
+
40
+ - Updates [`@typescript-eslint/typescript-eslint`](https://github.com/typescript-eslint/typescript-eslint) to v8, this brings a few new rules. See article for v8 <https://typescript-eslint.io/blog/announcing-typescript-eslint-v8>
41
+ - Moves from [`eslint-plugin-import`](https://github.com/import-js/eslint-plugin-import) to [`eslint-plugin-import-x`](https://github.com/un-ts/eslint-plugin-import-x). If you reference any of the `import/` rules you'll need to replace `import/` with `import-x/`.
42
+ - Some stylistic rules have been disabled (for example `function` vs arrow functions)
43
+
44
+ ## Usage
45
+
46
+ These configs works on both TypeScript and JavaSript out of the box. (as long as the file endings are any of `.js, .jsx, .mjs, .cjs, .ts, .tsx, .cts, .mts`)
47
+
48
+ To get started, create `eslint.config.js` (if your package json has `"type": "module"`), otherwise create `eslint.config.mjs`.
49
+ If you are not building your project with TypeScript (using Webpack or Vite for example), then tell TypeScript to include
50
+ all files by setting `"include": [".*", "**/*"]` in `tsconfig.json`.
51
+
52
+ For a pure browser environment with no specific frameworks use:
53
+
54
+ ```js
55
+ // @ts-check
56
+ import qlik from "@qlik/eslint-config";
57
+
58
+ export default qlik.compose(
59
+ ...qlik.configs.recommended, // adds linting on .js, .jsx, .mjs, .cjs, .ts, .tsx, .cts, .mts files. use for pure browser environment
60
+ {
61
+ ignores: ["dist", "npm", "node_modules"],
62
+ }
63
+ );
37
64
  ```
38
65
 
39
- Using svelte:
66
+ Using React with vitest:
40
67
 
41
- ```json
42
- "eslintConfig": {
43
- "root": true,
44
- "parserOptions": {
45
- "project": "path/to/tsconfig.json"
68
+ ```js
69
+ // @ts-check
70
+ import qlik from "@qlik/eslint-config";
71
+
72
+ export default qlik.compose(
73
+ ...qlik.configs.react, // based on the recommended config and adds react linting on .jsx and .tsx files
74
+ {
75
+ ignores: ["dist", "node_modules"],
46
76
  },
47
- "extends": [
48
- "@qlik/eslint-config/svelte"
49
- ]
50
- },
77
+ );
51
78
  ```
52
79
 
53
- Using react AND svelte (rare occasion):
80
+ Using Svelte:
54
81
 
55
- ```json
56
- "eslintConfig": {
57
- "root": true,
58
- "parserOptions": {
59
- "project": "path/to/tsconfig.json"
60
- },
61
- "extends": [
62
- "@qlik/eslint-config/react-svelte"
63
- ]
64
- },
82
+ ```js
83
+ // @ts-check
84
+ import qlik from "@qlik/eslint-config";
85
+
86
+ export default qlik.compose(
87
+ ...qlik.configs.svelte, // based on the recommended config and adds svelte linting on .svelte files
88
+ {
89
+ ignores: ["dist", "node_modules"],
90
+ }
91
+ );
65
92
  ```
66
93
 
67
- For a node environment with commonjs modules use:
94
+ Using React and Svelte:
68
95
 
69
- ```json
70
- "eslintConfig": {
71
- "root": true,
72
- "parserOptions": {
73
- "project": "path/to/tsconfig.json"
74
- },
75
- "extends": [
76
- "@qlik/eslint-config/node"
77
- ]
78
- },
96
+ ```js
97
+ // @ts-check
98
+ import qlik from "@qlik/eslint-config";
99
+
100
+ export default qlik.compose(
101
+ ...qlik.configs.react,
102
+ ...qlik.configs.svelte,
103
+ {
104
+ ignores: ["dist", "node_modules"],
105
+ }
106
+ );
79
107
  ```
80
108
 
81
- For a node environment with ES modules use:
109
+ Node environment:
82
110
 
83
- ```json
84
- "eslintConfig": {
85
- "root": true,
86
- "parserOptions": {
87
- "project": "path/to/tsconfig.json"
111
+ ```js
112
+ // @ts-check
113
+ import qlik from "@qlik/eslint-config";
114
+
115
+ export default qlik.compose(
116
+ ...qlik.configs.esm, // or qlik.configs.cjs for commonjs, recommended config with node environment enabled
117
+ {
118
+ ignores: ["dist", "npm", "node_modules"],
88
119
  },
89
- "extends": [
90
- "@qlik/eslint-config/esm"
91
- ]
92
- },
120
+ );
93
121
  ```
94
122
 
95
- Additional configs that can be used in conjunction with the above:
123
+ Additional configs that can be used in conjunction with the ones above:
124
+
125
+ ```js
126
+ // @ts-check
127
+ import qlik from "@qlik/eslint-config";
96
128
 
97
- ```json
98
- "eslintConfig": {
99
- "root": true,
100
- "parserOptions": {
101
- "project": "path/to/tsconfig.json"
129
+ export default qlik.compose(
130
+ ...qlik.configs.recommended, // pure browser environment
131
+ ...qlik.configs.vitest, // enable vitest linting on files inside __test(s)__ folder
132
+ ...qlik.configs.jest, // enable jest linting on files inside __test(s)__ folder, DON'T use together with vitest
133
+ ...qlik.configs.playwright, // enable playwright linting on files inside ./test(s) folder.
134
+ {
135
+ ignores: ["dist", "npm", "node_modules"],
102
136
  },
103
- "extends": [
104
- "...",
105
- "@qlik/eslint-config/vitest", // adds linting on vitest test and config files
106
- // AND/OR
107
- "@qlik/eslint-config/playwright" // adds linting on playwright test and config files
108
- ]
109
- },
137
+ );
110
138
  ```
139
+
140
+ A config can be extended if needed. For example if the default file patterns needs to be altered.
141
+
142
+ ```js
143
+ // @ts-check
144
+ import qlik from "@qlik/eslint-config";
145
+
146
+ export default qlik.compose(
147
+ ...qlik.configs.recommended, // pure browser environment, no framework config added
148
+ {
149
+ // adds vitest lint rules on the specified files with an altered rule
150
+ files: ['**/my_tests_are_here/*.spec.ts']
151
+ extends [qlik.configs.vitest],
152
+ rules: {
153
+ "vitest/max-nested-describe": [
154
+ "error",
155
+ {
156
+ "max": 3
157
+ }
158
+ ]
159
+ }
160
+ },
161
+ {
162
+ ignores: ["dist", "npm", "node_modules"],
163
+ },
164
+ );
165
+ ```
166
+
167
+ <!-- prettier-ignore-end -->
package/package.json CHANGED
@@ -1,67 +1,61 @@
1
1
  {
2
2
  "name": "@qlik/eslint-config",
3
- "version": "0.8.1",
4
- "description": "Qlik's ESLint config for typescript",
3
+ "version": "1.0.0",
4
+ "description": "Qlik's ESLint configs",
5
5
  "repository": "git@github.com:qlik-oss/dev-tools-js.git",
6
6
  "license": "ISC",
7
- "main": "index.js",
7
+ "type": "module",
8
+ "exports": {
9
+ ".": "./lib/index.js"
10
+ },
11
+ "module": "./src/index.js",
12
+ "types": "./src/index.d.ts",
8
13
  "files": [
9
- "configs",
10
- "overrides",
11
- "index.js",
12
- "jest.js",
13
- "node.js",
14
- "esm.js",
15
- "react.js",
16
- "svelte.js",
17
- "svelte-js.js",
18
- "vitest.js",
19
- "playwright.js",
20
- "react-svelte.js"
14
+ "src",
15
+ "!**/__tests__"
21
16
  ],
22
17
  "prettier": "@qlik/prettier-config",
23
- "eslintConfig": {
24
- "env": {
25
- "es6": true,
26
- "node": true
27
- },
28
- "extends": "eslint:recommended"
29
- },
30
18
  "dependencies": {
31
- "@typescript-eslint/eslint-plugin": "^7.18.0",
32
- "@typescript-eslint/parser": "^7.18.0",
33
- "eslint-config-airbnb": "^19.0.4",
34
- "eslint-config-airbnb-base": "^15.0.0",
35
- "eslint-config-airbnb-typescript": "^18.0.0",
36
- "eslint-config-prettier": "^9.1.0",
19
+ "@eslint-react/eslint-plugin": "1.17.1",
20
+ "@eslint/js": "^9.15.0",
21
+ "@typescript-eslint/utils": "^8.16.0",
22
+ "@vitest/eslint-plugin": "^1.1.10",
23
+ "confusing-browser-globals": "^1.0.11",
37
24
  "eslint-import-resolver-typescript": "^3.6.3",
38
- "eslint-plugin-import": "^2.30.0",
39
- "eslint-plugin-jest": "^28.8.3",
40
- "eslint-plugin-jsx-a11y": "^6.10.0",
41
- "eslint-plugin-playwright": "^1.6.2",
42
- "eslint-plugin-react": "^7.37.0",
43
- "eslint-plugin-react-hooks": "^4.6.2",
44
- "eslint-plugin-svelte": "^2.44.1",
45
- "eslint-plugin-testing-library": "^6.3.0",
46
- "eslint-plugin-vitest": "^0.4.1",
47
- "svelte-eslint-parser": "^0.41.1"
25
+ "eslint-plugin-import-x": "^4.4.3",
26
+ "eslint-plugin-jest": "^28.9.0",
27
+ "eslint-plugin-jsx-a11y": "^6.10.2",
28
+ "eslint-plugin-playwright": "2.1.0",
29
+ "eslint-plugin-react": "^7.37.2",
30
+ "eslint-plugin-react-hooks": "^5.0.0",
31
+ "eslint-plugin-svelte": "2.46.0",
32
+ "eslint-plugin-testing-library": "^7.0.0",
33
+ "globals": "^15.12.0",
34
+ "svelte-eslint-parser": "0.43.0",
35
+ "typescript-eslint": "^8.16.0"
48
36
  },
49
37
  "devDependencies": {
50
- "eslint": "^8.57.0",
51
- "prettier": "^3.3.3",
52
- "@qlik/prettier-config": "0.4.18"
38
+ "@types/confusing-browser-globals": "^1.0.3",
39
+ "@types/eslint-plugin-jsx-a11y": "^6.10.0",
40
+ "@types/eslint__js": "^8.42.3",
41
+ "eslint": "^9.15.0",
42
+ "prettier": "^3.4.1",
43
+ "vitest": "^2.1.6",
44
+ "@qlik/prettier-config": "0.4.19",
45
+ "@qlik/tsconfig": "0.2.8"
53
46
  },
54
47
  "peerDependencies": {
55
- "eslint": "^8.0.0"
48
+ "eslint": ">=9.0.0"
56
49
  },
57
50
  "engines": {
58
- "node": ">=16"
51
+ "node": ">=18"
59
52
  },
60
53
  "publishConfig": {
61
54
  "access": "public",
62
55
  "registry": "https://registry.npmjs.org/"
63
56
  },
64
57
  "scripts": {
58
+ "check-types": "tsc --noEmit",
65
59
  "format:check": "prettier --check '**' --ignore-unknown",
66
60
  "format:write": "prettier --write '**' --ignore-unknown",
67
61
  "lint": "eslint ."
@@ -0,0 +1,45 @@
1
+ // @ts-check
2
+ import globals from "globals";
3
+ import { mergeConfigs } from "../utils/config.js";
4
+ import { recommendedJS, recommendedTS } from "./recommended.js";
5
+
6
+ /**
7
+ * @satisfies {import("../types/index.js").ESLintFlatConfig['rules']}
8
+ */
9
+ const cjsRules = {
10
+ // modify rules for node here
11
+ };
12
+
13
+ /**
14
+ * @type {import("../types/index.js").ESLintFlatConfig}
15
+ */
16
+ const cjsJS = mergeConfigs(recommendedJS, {
17
+ name: "node-cjs-js",
18
+ files: ["**/*.{js,cjs}"],
19
+ languageOptions: {
20
+ globals: globals.node,
21
+ sourceType: "commonjs",
22
+ },
23
+ rules: {
24
+ ...cjsRules,
25
+ },
26
+ });
27
+
28
+ /**
29
+ * @type {import("../types/index.js").ESLintFlatConfig}
30
+ */
31
+ const cjsTS = mergeConfigs(recommendedTS, {
32
+ name: "node-cjs-ts",
33
+ files: ["**/*.{ts,cts}"],
34
+ languageOptions: {
35
+ globals: globals.node,
36
+ sourceType: "commonjs",
37
+ },
38
+ rules: {
39
+ ...cjsRules,
40
+ // modify ts specific rules for node here
41
+ },
42
+ });
43
+
44
+ export default [cjsJS, cjsTS];
45
+ export { cjsJS, cjsTS };
@@ -0,0 +1,43 @@
1
+ // @ts-check
2
+ import { mergeConfigs } from "../utils/config.js";
3
+ import { cjsJS, cjsTS } from "./cjs.js";
4
+
5
+ /**
6
+ * @satisfies {import("../types/index.js").ESLintFlatConfig["rules"]}
7
+ */
8
+ const nodeEsmRules = {
9
+ // modify rules for node esm here
10
+ "import-x/extensions": ["error", "ignorePackages"],
11
+ };
12
+
13
+ /**
14
+ * @type {import("../types/index.js").ESLintFlatConfig}
15
+ */
16
+ const esmJS = mergeConfigs(cjsJS, {
17
+ name: "node-esm-js",
18
+ files: ["**/*.{js,mjs}"],
19
+ languageOptions: {
20
+ sourceType: "module",
21
+ },
22
+ rules: {
23
+ ...nodeEsmRules,
24
+ },
25
+ });
26
+
27
+ /**
28
+ * @type {import("../types/index.js").ESLintFlatConfig}
29
+ */
30
+ const esmTS = mergeConfigs(cjsTS, {
31
+ name: "node-esm-ts",
32
+ files: ["**/*.{ts,mts}"],
33
+ languageOptions: {
34
+ sourceType: "module",
35
+ },
36
+ rules: {
37
+ ...nodeEsmRules,
38
+ // modify ts specific rules for node esm here
39
+ },
40
+ });
41
+
42
+ export default [esmJS, esmTS];
43
+ export { esmJS, esmTS };
@@ -0,0 +1,24 @@
1
+ // @ts-check
2
+ import jestPlugin from "eslint-plugin-jest";
3
+ import testingLibraryPlugin from "eslint-plugin-testing-library";
4
+ import { mergeConfigs } from "../utils/config.js";
5
+ import rules from "./rules/index.js";
6
+
7
+ /**
8
+ * @type {import("../types/index.js").ESLintFlatConfig}
9
+ * config for jest https://github.com/jest-community/eslint-plugin-jest
10
+ */
11
+ const jest = mergeConfigs(jestPlugin.configs["flat/recommended"], {
12
+ name: "jest-js",
13
+ files: ["**/__test__/**/*.{js,jsx,ts,tsx}", "**/__tests__/**/*.{js,jsx,ts,tsx}"],
14
+ plugins: {
15
+ "testing-library": testingLibraryPlugin,
16
+ },
17
+ rules: {
18
+ ...rules.testingLibraryRules,
19
+ // modify rules from eslint-plugin-jest here
20
+ },
21
+ });
22
+
23
+ export default [jest];
24
+ export { jest };
@@ -0,0 +1,19 @@
1
+ // @ts-check
2
+ import playwrightEslint from "eslint-plugin-playwright";
3
+ import { mergeConfigs } from "../utils/config.js";
4
+
5
+ /**
6
+ * @type {import("../types/index.js").ESLintFlatConfig}
7
+ * config for Playwright https://github.com/playwright-community/eslint-plugin-playwright
8
+ */
9
+ const playwright = mergeConfigs(playwrightEslint.configs["flat/recommended"], {
10
+ name: "playwright",
11
+ files: ["tests/**", "test/**"],
12
+ rules: {
13
+ ...playwrightEslint.configs["flat/recommended"].rules,
14
+ // modify rules from eslint-plugin-playwright here
15
+ },
16
+ });
17
+
18
+ export default [playwright];
19
+ export { playwright };
@@ -0,0 +1,75 @@
1
+ // @ts-check
2
+ import react from "@eslint-react/eslint-plugin";
3
+ import jsxA11y from "eslint-plugin-jsx-a11y";
4
+ import eslintPluginReact from "eslint-plugin-react";
5
+ // @ts-expect-error no types for this plugin yet
6
+ import reactHooks from "eslint-plugin-react-hooks";
7
+ import { mergeConfigs } from "../utils/config.js";
8
+ import { recommendedJS, recommendedTS } from "./recommended.js";
9
+ import rules from "./rules/index.js";
10
+
11
+ /** @type {any} */
12
+ const reactPlugin = eslintPluginReact;
13
+
14
+ /**
15
+ * @type {import("../types/index.js").ESLintFlatConfig}
16
+ */
17
+ const reactConfig = mergeConfigs({
18
+ languageOptions: {
19
+ parserOptions: {
20
+ ecmaFeatures: {
21
+ jsx: true,
22
+ },
23
+ jsxPragma: null, // for @typescript/eslint-parser
24
+ },
25
+ },
26
+
27
+ plugins: { ...react.configs.recommended.plugins, react: reactPlugin, "jsx-a11y": jsxA11y, "react-hooks": reactHooks },
28
+
29
+ settings: {
30
+ ...react.configs.recommended.settings,
31
+ react: {
32
+ version: "detect",
33
+ },
34
+ },
35
+
36
+ rules: {
37
+ // react plugin
38
+ ...reactPlugin.configs.flat.recommended.rules,
39
+ ...rules.reactRules,
40
+ // jsx-a11y plugin
41
+ ...jsxA11y.flatConfigs.recommended.rules,
42
+ ...rules.reactA11yRules,
43
+ ...react.configs.recommended.rules,
44
+ // react-hooks plugin
45
+ ...reactHooks.configs.recommended.rules,
46
+ ...rules.reactHooksRules,
47
+ },
48
+ });
49
+
50
+ /**
51
+ * @type {import("../types/index.js").ESLintFlatConfig}
52
+ */
53
+ const reactJS = mergeConfigs(reactConfig, recommendedJS, {
54
+ name: "react-js",
55
+ files: ["**/*.jsx"],
56
+ rules: {
57
+ // turn on/off or modify js rules necessary for react
58
+ "react/jsx-filename-extension": [2, { extensions: [".js", ".jsx"] }],
59
+ },
60
+ });
61
+
62
+ /**
63
+ * @type {import("../types/index.js").ESLintFlatConfig}
64
+ */
65
+ const reactTS = mergeConfigs(reactConfig, recommendedTS, {
66
+ name: "react-ts",
67
+ files: ["**/*.tsx"],
68
+ rules: {
69
+ // turn on/off or modify js/ts rules necessary for react
70
+ "react/jsx-filename-extension": [2, { extensions: [".js", ".jsx", ".ts", ".tsx"] }],
71
+ },
72
+ });
73
+
74
+ export default [recommendedJS, reactTS, recommendedTS, reactTS];
75
+ export { reactJS, reactTS };
@@ -0,0 +1,64 @@
1
+ // @ts-check
2
+ import js from "@eslint/js";
3
+ import tsParser from "@typescript-eslint/parser";
4
+ import eslintPluginImportX from "eslint-plugin-import-x";
5
+ import globals from "globals";
6
+ import tsconfig from "typescript-eslint";
7
+ import { mergeConfigs } from "../utils/config.js";
8
+ import rules from "./rules/index.js";
9
+
10
+ /**
11
+ * @type {import("../types/index.js").ESLintFlatConfig}
12
+ */
13
+ const recommendedJS = mergeConfigs(
14
+ {
15
+ files: ["**/*.js", "**/*.jsx", "**/*.mjs", "**/*.cjs"],
16
+ languageOptions: {
17
+ globals: globals.browser,
18
+ parserOptions: {
19
+ warnOnUnsupportedTypeScriptVersion: false,
20
+ },
21
+ ecmaVersion: 2021,
22
+ sourceType: "module",
23
+ },
24
+ },
25
+ // tsconfig.configs.base sets eslint parser to use the typescript parser to parse .js files - handles all modern syntax
26
+ tsconfig.configs.base,
27
+ js.configs.recommended,
28
+ eslintPluginImportX.flatConfigs.recommended,
29
+ {
30
+ name: "recommended-js",
31
+ rules: {
32
+ ...rules.importXRules,
33
+ ...rules.eslintCoreRules,
34
+ },
35
+ },
36
+ );
37
+
38
+ /**
39
+ * @type {import("../types/index.js").ESLintFlatConfig}
40
+ */
41
+ const recommendedTS = mergeConfigs(
42
+ recommendedJS,
43
+ {
44
+ files: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts", "**/*.d.ts"],
45
+ languageOptions: {
46
+ parserOptions: {
47
+ parser: tsParser,
48
+ projectService: true,
49
+ ecmaVersion: "latest",
50
+ sourceType: "module",
51
+ },
52
+ },
53
+ },
54
+ ...tsconfig.configs.recommended,
55
+ eslintPluginImportX.flatConfigs.recommended,
56
+ eslintPluginImportX.flatConfigs.typescript,
57
+ {
58
+ name: "recommended-ts",
59
+ rules: rules.typescriptRules,
60
+ },
61
+ );
62
+
63
+ export default [recommendedJS, recommendedTS];
64
+ export { recommendedJS, recommendedTS };