@dvukovic/style-guide 0.3.92 → 0.3.94

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 (66) hide show
  1. package/README.md +112 -115
  2. package/package.json +55 -53
  3. package/src/cspell/base.txt +2 -0
  4. package/src/eslint/configs/core.js +35 -19
  5. package/src/eslint/configs/core.test.js +23 -0
  6. package/src/eslint/configs/jest.js +5 -4
  7. package/src/eslint/configs/jest.test.js +17 -0
  8. package/src/eslint/configs/mobx.js +5 -4
  9. package/src/eslint/configs/mobx.test.js +17 -0
  10. package/src/eslint/configs/next.js +5 -4
  11. package/src/eslint/configs/next.test.js +17 -0
  12. package/src/eslint/configs/node.js +6 -4
  13. package/src/eslint/configs/node.test.js +17 -0
  14. package/src/eslint/configs/playwright.js +5 -4
  15. package/src/eslint/configs/playwright.test.js +17 -0
  16. package/src/eslint/configs/react.js +6 -4
  17. package/src/eslint/configs/react.test.js +17 -0
  18. package/src/eslint/configs/storybook.js +15 -10
  19. package/src/eslint/configs/storybook.test.js +17 -0
  20. package/src/eslint/configs/typescript-strict.js +31 -24
  21. package/src/eslint/configs/typescript-strict.test.js +17 -0
  22. package/src/eslint/configs/typescript.js +6 -4
  23. package/src/eslint/configs/typescript.test.js +17 -0
  24. package/src/eslint/configs/vitest.js +5 -4
  25. package/src/eslint/configs/vitest.test.js +17 -0
  26. package/src/eslint/plugins/es-x.js +8 -15
  27. package/src/eslint/plugins/eslint-comments.js +10 -8
  28. package/src/eslint/plugins/eslint.js +13 -8
  29. package/src/eslint/plugins/etc.js +3 -13
  30. package/src/eslint/plugins/import-x.js +8 -4
  31. package/src/eslint/plugins/jest.js +9 -3
  32. package/src/eslint/plugins/mobx.js +8 -3
  33. package/src/eslint/plugins/n.js +8 -3
  34. package/src/eslint/plugins/next.js +8 -3
  35. package/src/eslint/plugins/playwright.js +9 -3
  36. package/src/eslint/plugins/prettier.js +12 -0
  37. package/src/eslint/plugins/promise.js +11 -15
  38. package/src/eslint/plugins/react-hooks.js +8 -3
  39. package/src/eslint/plugins/react.js +13 -4
  40. package/src/eslint/plugins/rimac.js +8 -3
  41. package/src/eslint/plugins/security-node.js +8 -3
  42. package/src/eslint/plugins/simple-import-sort.js +8 -3
  43. package/src/eslint/plugins/sonarjs.js +38 -32
  44. package/src/eslint/plugins/sort-destructure-keys.js +8 -3
  45. package/src/eslint/plugins/sort-keys-fix.js +8 -3
  46. package/src/eslint/plugins/storybook.js +8 -3
  47. package/src/eslint/plugins/stylistic.js +8 -3
  48. package/src/eslint/plugins/typescript-eslint.js +10 -6
  49. package/src/eslint/plugins/typescript-sort-keys.js +8 -3
  50. package/src/eslint/plugins/unicorn.js +20 -3
  51. package/src/eslint/plugins/unused-imports.js +8 -3
  52. package/src/eslint/plugins/vitest.js +30 -5
  53. package/src/package-json/configs/core.js +3 -5
  54. package/src/package-json/plugins/package-json.js +2 -4
  55. package/src/prettier/configs/core.js +6 -4
  56. package/src/prettier/configs/core.test.js +24 -0
  57. package/src/prettier/plugins/embed.js +2 -4
  58. package/src/prettier/plugins/prettier.js +2 -4
  59. package/src/prettier/plugins/sql.js +2 -4
  60. package/src/stylelint/configs/core.js +8 -4
  61. package/src/stylelint/configs/core.test.js +24 -0
  62. package/src/stylelint/plugins/no-unused-selectors.js +8 -0
  63. package/src/stylelint/plugins/order.js +2 -4
  64. package/src/stylelint/plugins/stylelint.js +9 -4
  65. package/src/graphql/configs/core.js +0 -4
  66. package/src/graphql/plugins/graphql.js +0 -96
package/README.md CHANGED
@@ -1,167 +1,153 @@
1
1
  # Style Guide
2
2
 
3
- ## Getting Started
3
+ Linting and formatting configuration for TypeScript/JavaScript projects.
4
4
 
5
- To get the kitchen sink install the required dependencies:
5
+ ## Installation
6
6
 
7
+ ```bash
8
+ yarn add -D @dvukovic/style-guide eslint prettier cspell stylelint npm-package-json-lint
7
9
  ```
8
- yarn add -D eslint@8.57.0 prettier cspell stylelint npm-package-json-lint @dvukovic/style-guide
9
- ```
10
10
 
11
- add the following scripts
11
+ ## Setup
12
+
13
+ Add these scripts to your `package.json`:
12
14
 
13
15
  ```json
14
16
  {
15
17
  "scripts": {
16
- "lint": "yarn lint:prettier && yarn lint:eslint && yarn lint:stylelint && yarn lint:spell && yarn lint:package-json",
17
- "lint:eslint": "eslint . --cache",
18
- "lint:fix": "yarn lint:eslint --fix && yarn lint:prettier --write && yarn lint:stylelint --fix && yarn lint:spell && yarn lint:package-json",
18
+ "lint": "yarn lint:eslint && yarn lint:prettier && yarn lint:stylelint && yarn lint:spell && yarn lint:package-json",
19
+ "lint:eslint": "eslint . --cache --concurrency=auto",
20
+ "lint:fix": "yarn lint:eslint --fix && yarn lint:prettier --write && yarn lint:stylelint --fix",
19
21
  "lint:package-json": "npmPkgJsonLint --configFile ./.packagerc.js .",
20
- "lint:prettier": "prettier --log-level=warn --check --cache .",
22
+ "lint:prettier": "prettier --check --cache '**/*.{json,yaml,yml,md,css,html}'",
21
23
  "lint:spell": "cspell --config ./.cspellrc.js --no-progress --no-summary --unique '**'",
22
24
  "lint:stylelint": "stylelint ./**/*.css --cache"
23
25
  }
24
26
  }
25
27
  ```
26
28
 
27
- add the following to `.gitignore`
29
+ Add to `.gitignore`:
28
30
 
29
31
  ```
30
32
  .eslintcache
31
33
  .stylelintcache
32
34
  ```
33
35
 
34
- ### ESLint
36
+ ---
35
37
 
36
- Create a `.eslintrc.js` in root with the following:
38
+ ## ESLint
37
39
 
38
- ```javascript
39
- /** @type {import("eslint").ESLint.ConfigData} */
40
- module.exports = {
41
- root: true,
42
- extends: [
43
- // JS/TS
44
- require.resolve("@dvukovic/style-guide/src/eslint/configs/core"),
45
- require.resolve("@dvukovic/style-guide/src/eslint/configs/node"),
46
-
47
- // Libraries
48
- require.resolve("@dvukovic/style-guide/src/eslint/configs/next"),
49
- require.resolve("@dvukovic/style-guide/src/eslint/configs/mobx"),
50
- require.resolve("@dvukovic/style-guide/src/eslint/configs/react"),
51
- ],
52
- parser: "@typescript-eslint/parser",
53
- parserOptions: {
54
- ecmaVersion: 2024,
55
- project: "./tsconfig.json",
56
- },
57
- overrides: [
58
- {
59
- files: ["*.ts", "*.tsx"],
60
- extends: [require.resolve("@dvukovic/style-guide/src/eslint/configs/typescript")],
61
- },
62
- {
63
- files: ["*.test.ts"],
64
- extends: [
65
- require.resolve(
66
- "@dvukovic/style-guide/src/eslint/configs/jest",
67
- // OR
68
- "@dvukovic/style-guide/src/eslint/configs/vitest",
69
- ),
70
- ],
71
- },
72
- {
73
- files: ["*.ui.test.ts"],
74
- extends: [require.resolve("@dvukovic/style-guide/src/eslint/configs/playwright")],
75
- },
76
- {
77
- extends: [require.resolve("@dvukovic/style-guide/src/eslint/configs/storybook")],
78
- files: ["./**/*.stories.@(ts|tsx)"],
79
- },
80
- ],
81
- }
82
- ```
40
+ Prettier is integrated into ESLint via `eslint-plugin-prettier` for JS/TS files. The separate
41
+ `lint:prettier` script handles JSON, YAML, MD, and other files.
83
42
 
84
- If you need graphql config, everything has to be configured trough `overrides`
43
+ Create `eslint.config.js`:
85
44
 
86
45
  ```javascript
87
- /** @type {import("eslint").ESLint.ConfigData} */
88
- module.exports = {
89
- ignorePatterns: ["node_modules"],
90
- overrides: [
91
- {
92
- extends: [
93
- require.resolve("@dvukovic/style-guide/src/eslint/configs/core"),
94
- require.resolve("@dvukovic/style-guide/src/eslint/configs/node"),
95
- require.resolve("@dvukovic/style-guide/src/eslint/configs/mobx"),
96
- require.resolve("@dvukovic/style-guide/src/eslint/configs/react"),
97
- require.resolve("@dvukovic/style-guide/src/eslint/configs/next"),
98
- ],
99
- files: ["*.js", ".ts", ".*.cjs", "*.tsx"],
100
- },
101
- {
102
- extends: [require.resolve("@dvukovic/style-guide/src/eslint/configs/typescript")],
103
- files: ["*.ts", "*.tsx"],
104
- },
105
- {
106
- extends: [
107
- require.resolve("@dvukovic/style-guide/src/eslint/configs/jest"),
108
- // OR
109
- require.resolve("@dvukovic/style-guide/src/eslint/configs/vitest"),
110
- ],
111
- files: ["*.test.ts", "*.test.js"],
112
- },
113
- {
114
- files: ["*.ui.test.ts"],
115
- extends: [require.resolve("@dvukovic/style-guide/src/eslint/configs/playwright")],
116
- },
117
- {
118
- extends: [require.resolve("@dvukovic/style-guide/src/graphql/configs/core")],
119
- files: ["*.graphql"],
120
- parser: "@graphql-eslint/eslint-plugin",
46
+ import tseslint from "typescript-eslint"
47
+
48
+ import core from "@dvukovic/style-guide/src/eslint/configs/core.js"
49
+ import jest from "@dvukovic/style-guide/src/eslint/configs/jest.js"
50
+ import mobx from "@dvukovic/style-guide/src/eslint/configs/mobx.js"
51
+ import next from "@dvukovic/style-guide/src/eslint/configs/next.js"
52
+ import node from "@dvukovic/style-guide/src/eslint/configs/node.js"
53
+ import playwright from "@dvukovic/style-guide/src/eslint/configs/playwright.js"
54
+ import react from "@dvukovic/style-guide/src/eslint/configs/react.js"
55
+ import storybook from "@dvukovic/style-guide/src/eslint/configs/storybook.js"
56
+ import typescript from "@dvukovic/style-guide/src/eslint/configs/typescript.js"
57
+ import typescriptStrict from "@dvukovic/style-guide/src/eslint/configs/typescript-strict.js"
58
+ import vitest from "@dvukovic/style-guide/src/eslint/configs/vitest.js"
59
+
60
+ export default tseslint.config(
61
+ { ignores: ["node_modules", ".next", "dist", "build"] },
62
+ ...core,
63
+ ...node,
64
+ ...next,
65
+ ...mobx,
66
+ ...react,
67
+ {
68
+ languageOptions: {
69
+ parser: tseslint.parser,
121
70
  parserOptions: {
122
71
  project: "./tsconfig.json",
123
- schema: "./**/*.graphql",
124
72
  },
125
73
  },
126
- ],
127
- parser: "@typescript-eslint/parser",
128
- parserOptions: {
129
- ecmaVersion: 2024,
130
- project: "./tsconfig.json",
131
74
  },
132
- root: true,
133
- }
75
+ {
76
+ files: ["**/*.ts", "**/*.tsx"],
77
+ extends: [...typescript, ...typescriptStrict],
78
+ },
79
+ {
80
+ files: ["**/*.test.ts"],
81
+ extends: [...jest],
82
+ },
83
+ {
84
+ files: ["**/*.test.ts"],
85
+ extends: [...vitest],
86
+ },
87
+ {
88
+ files: ["**/*.ui.test.ts"],
89
+ extends: [...playwright],
90
+ },
91
+ {
92
+ files: ["**/*.stories.ts", "**/*.stories.tsx"],
93
+ extends: [...storybook],
94
+ },
95
+ )
134
96
  ```
135
97
 
136
- ### Prettier
98
+ ### Available Configs
137
99
 
138
- Create a `.prettierrc.js` in root with the following:
100
+ | Config | Description |
101
+ | ------------------- | -------------------------------- |
102
+ | `core` | Base JavaScript rules + Prettier |
103
+ | `node` | Node.js specific rules |
104
+ | `react` | React and JSX rules |
105
+ | `next` | Next.js specific rules |
106
+ | `mobx` | MobX state management rules |
107
+ | `typescript` | TypeScript rules |
108
+ | `typescript-strict` | Strict TypeScript rules |
109
+ | `jest` | Jest testing rules |
110
+ | `vitest` | Vitest testing rules |
111
+ | `playwright` | Playwright E2E testing rules |
112
+ | `storybook` | Storybook rules |
113
+
114
+ ---
115
+
116
+ ## Prettier
117
+
118
+ Create `prettier.config.js`:
139
119
 
140
120
  ```javascript
121
+ import prettierConfig from "@dvukovic/style-guide/src/prettier/configs/core.js"
122
+
141
123
  /** @type {import("prettier").Config} */
142
- module.exports = {
143
- ...require("@dvukovic/style-guide/src/prettier/configs/core"),
124
+ export default {
125
+ ...prettierConfig,
144
126
  }
145
127
  ```
146
128
 
147
- ### Stylelint
129
+ ---
130
+
131
+ ## Stylelint
148
132
 
149
- Create a `.stylelintrc.js` in root with the following:
133
+ Create `.stylelintrc.js`:
150
134
 
151
135
  ```javascript
152
136
  /** @type {import("stylelint").Config} */
153
- module.exports = {
154
- extends: "@dvukovic/style-guide/src/stylelint/configs/core",
137
+ export default {
138
+ extends: "@dvukovic/style-guide/src/stylelint/configs/core.js",
155
139
  }
156
140
  ```
157
141
 
158
- ### CSpell
142
+ ---
159
143
 
160
- Create a `.cspellrc.js` in root with the following:
144
+ ## CSpell
145
+
146
+ Create `.cspellrc.js`:
161
147
 
162
148
  ```javascript
163
149
  /** @type {import("cspell").FileSettings} */
164
- module.exports = {
150
+ export default {
165
151
  cache: {
166
152
  cacheLocation: "./node_modules/.cache/cspell",
167
153
  useCache: true,
@@ -178,13 +164,24 @@ module.exports = {
178
164
  }
179
165
  ```
180
166
 
181
- ### Package Json Lint
167
+ ---
168
+
169
+ ## Package JSON Lint
182
170
 
183
- Create a `.packagerc.js` in root with the following:
171
+ Create `.packagerc.js`:
184
172
 
185
173
  ```javascript
186
174
  /** @type {import("npm-package-json-lint").NpmPackageJsonLint} */
187
- module.exports = {
188
- extends: "@dvukovic/style-guide/src/package-json/configs/core",
175
+ export default {
176
+ extends: "@dvukovic/style-guide/src/package-json/configs/core.js",
189
177
  }
190
178
  ```
179
+
180
+ ---
181
+
182
+ ## Requirements
183
+
184
+ - Node.js >= 20.0.0
185
+ - ESLint 9+
186
+ - Prettier 3+
187
+ - Stylelint 16+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dvukovic/style-guide",
3
- "version": "0.3.92",
3
+ "version": "0.3.94",
4
4
  "description": "My own style guide",
5
5
  "repository": {
6
6
  "type": "git",
@@ -10,85 +10,87 @@
10
10
  "author": {
11
11
  "name": "Domagoj Vukovic"
12
12
  },
13
- "type": "commonjs",
13
+ "type": "module",
14
14
  "files": [
15
15
  "src/eslint",
16
16
  "src/cspell",
17
- "src/graphql",
18
17
  "src/prettier",
19
18
  "src/stylelint",
20
19
  "src/package-json"
21
20
  ],
22
21
  "scripts": {
23
- "lint": "yarn lint:prettier && yarn lint:eslint && yarn lint:stylelint && yarn lint:spell && yarn lint:package-json",
24
- "lint:eslint": "eslint . --cache",
25
- "lint:fix": "yarn lint:eslint --fix && yarn lint:prettier --write && yarn lint:stylelint --fix && yarn lint:spell && yarn lint:package-json",
26
- "lint:package-json": "npmPkgJsonLint --configFile ./.packagerc.js .",
27
- "lint:prettier": "prettier --log-level=warn --check --cache .",
22
+ "lint": "yarn lint:eslint && yarn lint:prettier && yarn lint:stylelint && yarn lint:spell",
23
+ "lint:eslint": "eslint . --cache --concurrency=auto",
24
+ "lint:fix": "yarn lint:eslint --fix && yarn lint:prettier --write && yarn lint:stylelint --fix",
25
+ "lint:prettier": "prettier --check --cache '**/*.{json,yaml,yml,md,css,html}'",
28
26
  "lint:spell": "cspell --config ./.cspellrc.js --no-progress --no-summary --unique '**'",
29
27
  "lint:stylelint": "stylelint ./**/*.css --cache",
30
- "release": "release-it"
28
+ "release": "release-it",
29
+ "test": "vitest run"
31
30
  },
32
31
  "dependencies": {
33
- "@eslint-community/eslint-plugin-eslint-comments": "4.4.1",
34
- "@graphql-eslint/eslint-plugin": "3.20.1",
35
- "@next/eslint-plugin-next": "15.1.6",
36
- "@prettier/plugin-xml": "3.4.1",
32
+ "@eslint-community/eslint-plugin-eslint-comments": "4.5.0",
33
+ "@next/eslint-plugin-next": "16.0.6",
34
+ "@prettier/plugin-xml": "3.4.2",
37
35
  "@rimac-technology/eslint-plugin": "1.5.0",
38
- "@stylistic/eslint-plugin": "3.0.1",
39
- "@typescript-eslint/parser": "8.23.0",
40
- "@vitest/eslint-plugin": "1.1.25",
41
- "eslint-plugin-es-x": "8.5.0",
36
+ "@stylistic/eslint-plugin": "5.6.1",
37
+ "@typescript-eslint/parser": "8.48.0",
38
+ "@vitest/eslint-plugin": "1.5.1",
39
+ "eslint-plugin-es-x": "9.2.0",
42
40
  "eslint-plugin-etc": "2.0.3",
43
- "eslint-plugin-import-x": "4.6.1",
44
- "eslint-plugin-jest": "28.11.0",
41
+ "eslint-plugin-import-x": "4.16.1",
42
+ "eslint-plugin-jest": "29.2.1",
45
43
  "eslint-plugin-mobx": "0.0.13",
46
- "eslint-plugin-n": "17.15.1",
47
- "eslint-plugin-playwright": "2.2.0",
44
+ "eslint-plugin-n": "17.23.1",
45
+ "eslint-plugin-playwright": "2.4.0",
46
+ "eslint-plugin-prettier": "5.5.4",
48
47
  "eslint-plugin-promise": "7.2.1",
49
- "eslint-plugin-react": "7.37.4",
50
- "eslint-plugin-react-hooks": "5.1.0",
48
+ "eslint-plugin-react": "7.37.5",
49
+ "eslint-plugin-react-hooks": "7.0.1",
51
50
  "eslint-plugin-security-node": "1.1.4",
52
51
  "eslint-plugin-simple-import-sort": "12.1.1",
53
- "eslint-plugin-sonarjs": "1.0.4",
52
+ "eslint-plugin-sonarjs": "3.0.5",
54
53
  "eslint-plugin-sort-destructure-keys": "2.0.0",
55
54
  "eslint-plugin-sort-keys-fix": "1.1.2",
56
- "eslint-plugin-storybook": "0.11.6",
55
+ "eslint-plugin-storybook": "10.1.2",
57
56
  "eslint-plugin-typescript-sort-keys": "3.3.0",
58
- "eslint-plugin-unicorn": "56.0.1",
59
- "eslint-plugin-unused-imports": "4.1.4",
57
+ "eslint-plugin-unicorn": "62.0.0",
58
+ "eslint-plugin-unused-imports": "4.3.0",
59
+ "globals": "16.5.0",
60
60
  "prettier-plugin-embed": "0.5.0",
61
- "prettier-plugin-jsdoc": "1.3.3",
62
- "prettier-plugin-packagejson": "2.5.17",
61
+ "prettier-plugin-jsdoc": "1.7.0",
62
+ "prettier-plugin-packagejson": "2.5.20",
63
63
  "prettier-plugin-prisma": "5.0.0",
64
64
  "prettier-plugin-sh": "0.18.0",
65
- "prettier-plugin-sql": "0.19.1",
66
- "prettier-plugin-tailwindcss": "0.6.13",
67
- "prettier-plugin-toml": "2.0.5",
68
- "stylelint-order": "6.0.4",
69
- "typescript-eslint": "8.23.0"
65
+ "prettier-plugin-sql": "0.19.2",
66
+ "prettier-plugin-tailwindcss": "0.7.2",
67
+ "prettier-plugin-toml": "2.0.6",
68
+ "stylelint-no-unused-selectors": "1.0.40",
69
+ "stylelint-order": "7.0.0",
70
+ "typescript-eslint": "8.48.0"
70
71
  },
71
72
  "devDependencies": {
72
- "@storybook/react": "8.6.7",
73
- "@types/eslint": "8.56.12",
74
- "@types/jest": "29.5.14",
75
- "@types/node": "22.13.1",
76
- "@types/react": "19.0.8",
77
- "cspell": "8.17.3",
78
- "eslint": "8.57.1",
79
- "graphql": "16.10.0",
80
- "jest": "29.7.0",
81
- "npm-package-json-lint": "8.0.0",
82
- "prettier": "3.6.2",
83
- "react": "19.0.0",
84
- "release-it": "18.1.2",
85
- "stylelint": "16.14.1",
86
- "typescript": "5.7.3"
73
+ "@storybook/react": "10.1.2",
74
+ "@types/eslint": "9.6.1",
75
+ "@types/jest": "30.0.0",
76
+ "@types/node": "24.10.1",
77
+ "@types/react": "19.2.7",
78
+ "cspell": "9.3.2",
79
+ "eslint": "9.39.1",
80
+ "jest": "30.2.0",
81
+ "npm-package-json-lint": "9.0.0",
82
+ "prettier": "3.7.3",
83
+ "react": "19.2.0",
84
+ "release-it": "19.0.6",
85
+ "storybook": "^10.1.2",
86
+ "stylelint": "16.26.1",
87
+ "typescript": "5.9.3",
88
+ "vitest": "^4.0.14"
87
89
  },
88
90
  "peerDependencies": {
89
- "cspell": "8 || 9",
90
- "eslint": "8.57.1",
91
- "npm-package-json-lint": "8",
91
+ "cspell": "9",
92
+ "eslint": "^9",
93
+ "npm-package-json-lint": "9",
92
94
  "prettier": "3",
93
95
  "stylelint": "16"
94
96
  },
@@ -109,7 +111,7 @@
109
111
  "optional": true
110
112
  }
111
113
  },
112
- "packageManager": "yarn@4.9.2",
114
+ "packageManager": "yarn@4.12.0",
113
115
  "engines": {
114
116
  "node": ">=20.0.0"
115
117
  },
@@ -111,3 +111,5 @@ kniprc
111
111
  webrtc
112
112
  speculationrules
113
113
  hrefs
114
+ supabase
115
+ tslog
@@ -1,19 +1,35 @@
1
- /** @type {import("eslint").ESLint.ConfigData} */
2
- module.exports = {
3
- extends: [
4
- "../plugins/eslint.js",
5
- "../plugins/es-x.js",
6
- "../plugins/eslint-comments.js",
7
- "../plugins/promise.js",
8
- "../plugins/unicorn.js",
9
- "../plugins/unused-imports.js",
10
- "../plugins/import-x.js",
11
- "../plugins/sonarjs.js",
12
- "../plugins/etc.js",
13
- "../plugins/sort-keys-fix.js",
14
- "../plugins/sort-destructure-keys.js",
15
- "../plugins/stylistic.js",
16
- "../plugins/simple-import-sort.js",
17
- "../plugins/rimac.js",
18
- ],
19
- }
1
+ import esXPlugin from "../plugins/es-x.js"
2
+ import eslintPlugin from "../plugins/eslint.js"
3
+ import eslintCommentsPlugin from "../plugins/eslint-comments.js"
4
+ import etcPlugin from "../plugins/etc.js"
5
+ import importXPlugin from "../plugins/import-x.js"
6
+ import prettierPlugin from "../plugins/prettier.js"
7
+ import promisePlugin from "../plugins/promise.js"
8
+ import rimacPlugin from "../plugins/rimac.js"
9
+ import simpleImportSortPlugin from "../plugins/simple-import-sort.js"
10
+ import sonarjsPlugin from "../plugins/sonarjs.js"
11
+ import sortDestructureKeysPlugin from "../plugins/sort-destructure-keys.js"
12
+ import sortKeysFixPlugin from "../plugins/sort-keys-fix.js"
13
+ import stylisticPlugin from "../plugins/stylistic.js"
14
+ import unicornPlugin from "../plugins/unicorn.js"
15
+ import unusedImportsPlugin from "../plugins/unused-imports.js"
16
+
17
+ const coreConfig = [
18
+ eslintPlugin,
19
+ esXPlugin,
20
+ eslintCommentsPlugin,
21
+ promisePlugin,
22
+ unicornPlugin,
23
+ unusedImportsPlugin,
24
+ importXPlugin,
25
+ sonarjsPlugin,
26
+ etcPlugin,
27
+ sortKeysFixPlugin,
28
+ sortDestructureKeysPlugin,
29
+ stylisticPlugin,
30
+ simpleImportSortPlugin,
31
+ rimacPlugin,
32
+ prettierPlugin,
33
+ ]
34
+
35
+ export default coreConfig
@@ -0,0 +1,23 @@
1
+ import { ESLint } from "eslint"
2
+
3
+ import config from "./core.js"
4
+
5
+ const eslint = new ESLint({
6
+ overrideConfig: config,
7
+ overrideConfigFile: true,
8
+ })
9
+
10
+ describe("core", () => {
11
+ test("loads without errors", async () => {
12
+ const results = await eslint.lintText("const x = 1\n", { filePath: "test.js" })
13
+
14
+ expect(results).toBeDefined()
15
+ expect(results[0].fatalErrorCount).toBe(0)
16
+ })
17
+
18
+ test("detects violations", async () => {
19
+ const results = await eslint.lintText("var x = 1\n", { filePath: "test.js" })
20
+
21
+ expect(results[0].errorCount).toBeGreaterThan(0)
22
+ })
23
+ })
@@ -1,4 +1,5 @@
1
- /** @type {import("eslint").ESLint.ConfigData} */
2
- module.exports = {
3
- extends: ["../plugins/jest.js"],
4
- }
1
+ import jestPlugin from "../plugins/jest.js"
2
+
3
+ const jestConfig = [jestPlugin]
4
+
5
+ export default jestConfig
@@ -0,0 +1,17 @@
1
+ import { ESLint } from "eslint"
2
+
3
+ import config from "./jest.js"
4
+
5
+ const eslint = new ESLint({
6
+ overrideConfig: config,
7
+ overrideConfigFile: true,
8
+ })
9
+
10
+ describe("jest", () => {
11
+ test("loads without errors", async () => {
12
+ const results = await eslint.lintText("const x = 1\n", { filePath: "test.test.js" })
13
+
14
+ expect(results).toBeDefined()
15
+ expect(results[0].fatalErrorCount).toBe(0)
16
+ })
17
+ })
@@ -1,4 +1,5 @@
1
- /** @type {import("eslint").ESLint.ConfigData} */
2
- module.exports = {
3
- extends: ["../plugins/mobx.js"],
4
- }
1
+ import mobxPlugin from "../plugins/mobx.js"
2
+
3
+ const mobxConfig = [mobxPlugin]
4
+
5
+ export default mobxConfig
@@ -0,0 +1,17 @@
1
+ import { ESLint } from "eslint"
2
+
3
+ import config from "./mobx.js"
4
+
5
+ const eslint = new ESLint({
6
+ overrideConfig: config,
7
+ overrideConfigFile: true,
8
+ })
9
+
10
+ describe("mobx", () => {
11
+ test("loads without errors", async () => {
12
+ const results = await eslint.lintText("const x = 1\n", { filePath: "test.js" })
13
+
14
+ expect(results).toBeDefined()
15
+ expect(results[0].fatalErrorCount).toBe(0)
16
+ })
17
+ })
@@ -1,4 +1,5 @@
1
- /** @type {import("eslint").ESLint.ConfigData} */
2
- module.exports = {
3
- extends: ["../plugins/next.js"],
4
- }
1
+ import nextPlugin from "../plugins/next.js"
2
+
3
+ const nextConfig = [nextPlugin]
4
+
5
+ export default nextConfig
@@ -0,0 +1,17 @@
1
+ import { ESLint } from "eslint"
2
+
3
+ import config from "./next.js"
4
+
5
+ const eslint = new ESLint({
6
+ overrideConfig: config,
7
+ overrideConfigFile: true,
8
+ })
9
+
10
+ describe("next", () => {
11
+ test("loads without errors", async () => {
12
+ const results = await eslint.lintText("const x = 1\n", { filePath: "test.tsx" })
13
+
14
+ expect(results).toBeDefined()
15
+ expect(results[0].fatalErrorCount).toBe(0)
16
+ })
17
+ })
@@ -1,4 +1,6 @@
1
- /** @type {import("eslint").ESLint.ConfigData} */
2
- module.exports = {
3
- extends: ["../plugins/n.js", "../plugins/security-node.js"],
4
- }
1
+ import nPlugin from "../plugins/n.js"
2
+ import securityNodePlugin from "../plugins/security-node.js"
3
+
4
+ const nodeConfig = [nPlugin, securityNodePlugin]
5
+
6
+ export default nodeConfig
@@ -0,0 +1,17 @@
1
+ import { ESLint } from "eslint"
2
+
3
+ import config from "./node.js"
4
+
5
+ const eslint = new ESLint({
6
+ overrideConfig: config,
7
+ overrideConfigFile: true,
8
+ })
9
+
10
+ describe("node", () => {
11
+ test("loads without errors", async () => {
12
+ const results = await eslint.lintText("const x = 1\n", { filePath: "test.js" })
13
+
14
+ expect(results).toBeDefined()
15
+ expect(results[0].fatalErrorCount).toBe(0)
16
+ })
17
+ })