@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.
- package/README.md +112 -115
- package/package.json +55 -53
- package/src/cspell/base.txt +2 -0
- package/src/eslint/configs/core.js +35 -19
- package/src/eslint/configs/core.test.js +23 -0
- package/src/eslint/configs/jest.js +5 -4
- package/src/eslint/configs/jest.test.js +17 -0
- package/src/eslint/configs/mobx.js +5 -4
- package/src/eslint/configs/mobx.test.js +17 -0
- package/src/eslint/configs/next.js +5 -4
- package/src/eslint/configs/next.test.js +17 -0
- package/src/eslint/configs/node.js +6 -4
- package/src/eslint/configs/node.test.js +17 -0
- package/src/eslint/configs/playwright.js +5 -4
- package/src/eslint/configs/playwright.test.js +17 -0
- package/src/eslint/configs/react.js +6 -4
- package/src/eslint/configs/react.test.js +17 -0
- package/src/eslint/configs/storybook.js +15 -10
- package/src/eslint/configs/storybook.test.js +17 -0
- package/src/eslint/configs/typescript-strict.js +31 -24
- package/src/eslint/configs/typescript-strict.test.js +17 -0
- package/src/eslint/configs/typescript.js +6 -4
- package/src/eslint/configs/typescript.test.js +17 -0
- package/src/eslint/configs/vitest.js +5 -4
- package/src/eslint/configs/vitest.test.js +17 -0
- package/src/eslint/plugins/es-x.js +8 -15
- package/src/eslint/plugins/eslint-comments.js +10 -8
- package/src/eslint/plugins/eslint.js +13 -8
- package/src/eslint/plugins/etc.js +3 -13
- package/src/eslint/plugins/import-x.js +8 -4
- package/src/eslint/plugins/jest.js +9 -3
- package/src/eslint/plugins/mobx.js +8 -3
- package/src/eslint/plugins/n.js +8 -3
- package/src/eslint/plugins/next.js +8 -3
- package/src/eslint/plugins/playwright.js +9 -3
- package/src/eslint/plugins/prettier.js +12 -0
- package/src/eslint/plugins/promise.js +11 -15
- package/src/eslint/plugins/react-hooks.js +8 -3
- package/src/eslint/plugins/react.js +13 -4
- package/src/eslint/plugins/rimac.js +8 -3
- package/src/eslint/plugins/security-node.js +8 -3
- package/src/eslint/plugins/simple-import-sort.js +8 -3
- package/src/eslint/plugins/sonarjs.js +38 -32
- package/src/eslint/plugins/sort-destructure-keys.js +8 -3
- package/src/eslint/plugins/sort-keys-fix.js +8 -3
- package/src/eslint/plugins/storybook.js +8 -3
- package/src/eslint/plugins/stylistic.js +8 -3
- package/src/eslint/plugins/typescript-eslint.js +10 -6
- package/src/eslint/plugins/typescript-sort-keys.js +8 -3
- package/src/eslint/plugins/unicorn.js +20 -3
- package/src/eslint/plugins/unused-imports.js +8 -3
- package/src/eslint/plugins/vitest.js +30 -5
- package/src/package-json/configs/core.js +3 -5
- package/src/package-json/plugins/package-json.js +2 -4
- package/src/prettier/configs/core.js +6 -4
- package/src/prettier/configs/core.test.js +24 -0
- package/src/prettier/plugins/embed.js +2 -4
- package/src/prettier/plugins/prettier.js +2 -4
- package/src/prettier/plugins/sql.js +2 -4
- package/src/stylelint/configs/core.js +8 -4
- package/src/stylelint/configs/core.test.js +24 -0
- package/src/stylelint/plugins/no-unused-selectors.js +8 -0
- package/src/stylelint/plugins/order.js +2 -4
- package/src/stylelint/plugins/stylelint.js +9 -4
- package/src/graphql/configs/core.js +0 -4
- package/src/graphql/plugins/graphql.js +0 -96
package/README.md
CHANGED
|
@@ -1,167 +1,153 @@
|
|
|
1
1
|
# Style Guide
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Linting and formatting configuration for TypeScript/JavaScript projects.
|
|
4
4
|
|
|
5
|
-
|
|
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
|
-
|
|
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:
|
|
17
|
-
"lint:eslint": "eslint . --cache",
|
|
18
|
-
"lint:fix": "yarn lint:eslint --fix && yarn lint:prettier --write && yarn lint:stylelint --fix
|
|
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 --
|
|
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
|
-
|
|
29
|
+
Add to `.gitignore`:
|
|
28
30
|
|
|
29
31
|
```
|
|
30
32
|
.eslintcache
|
|
31
33
|
.stylelintcache
|
|
32
34
|
```
|
|
33
35
|
|
|
34
|
-
|
|
36
|
+
---
|
|
35
37
|
|
|
36
|
-
|
|
38
|
+
## ESLint
|
|
37
39
|
|
|
38
|
-
|
|
39
|
-
|
|
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
|
-
|
|
43
|
+
Create `eslint.config.js`:
|
|
85
44
|
|
|
86
45
|
```javascript
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
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
|
-
|
|
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
|
-
###
|
|
98
|
+
### Available Configs
|
|
137
99
|
|
|
138
|
-
|
|
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
|
-
|
|
143
|
-
...
|
|
124
|
+
export default {
|
|
125
|
+
...prettierConfig,
|
|
144
126
|
}
|
|
145
127
|
```
|
|
146
128
|
|
|
147
|
-
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Stylelint
|
|
148
132
|
|
|
149
|
-
Create
|
|
133
|
+
Create `.stylelintrc.js`:
|
|
150
134
|
|
|
151
135
|
```javascript
|
|
152
136
|
/** @type {import("stylelint").Config} */
|
|
153
|
-
|
|
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
|
-
|
|
142
|
+
---
|
|
159
143
|
|
|
160
|
-
|
|
144
|
+
## CSpell
|
|
145
|
+
|
|
146
|
+
Create `.cspellrc.js`:
|
|
161
147
|
|
|
162
148
|
```javascript
|
|
163
149
|
/** @type {import("cspell").FileSettings} */
|
|
164
|
-
|
|
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
|
-
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## Package JSON Lint
|
|
182
170
|
|
|
183
|
-
Create
|
|
171
|
+
Create `.packagerc.js`:
|
|
184
172
|
|
|
185
173
|
```javascript
|
|
186
174
|
/** @type {import("npm-package-json-lint").NpmPackageJsonLint} */
|
|
187
|
-
|
|
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.
|
|
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": "
|
|
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:
|
|
24
|
-
"lint:eslint": "eslint . --cache",
|
|
25
|
-
"lint:fix": "yarn lint:eslint --fix && yarn lint:prettier --write
|
|
26
|
-
"lint:
|
|
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.
|
|
34
|
-
"@
|
|
35
|
-
"@
|
|
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": "
|
|
39
|
-
"@typescript-eslint/parser": "8.
|
|
40
|
-
"@vitest/eslint-plugin": "1.1
|
|
41
|
-
"eslint-plugin-es-x": "
|
|
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.
|
|
44
|
-
"eslint-plugin-jest": "
|
|
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.
|
|
47
|
-
"eslint-plugin-playwright": "2.
|
|
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.
|
|
50
|
-
"eslint-plugin-react-hooks": "
|
|
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": "
|
|
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": "
|
|
55
|
+
"eslint-plugin-storybook": "10.1.2",
|
|
57
56
|
"eslint-plugin-typescript-sort-keys": "3.3.0",
|
|
58
|
-
"eslint-plugin-unicorn": "
|
|
59
|
-
"eslint-plugin-unused-imports": "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.
|
|
62
|
-
"prettier-plugin-packagejson": "2.5.
|
|
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.
|
|
66
|
-
"prettier-plugin-tailwindcss": "0.
|
|
67
|
-
"prettier-plugin-toml": "2.0.
|
|
68
|
-
"stylelint-
|
|
69
|
-
"
|
|
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": "
|
|
73
|
-
"@types/eslint": "
|
|
74
|
-
"@types/jest": "
|
|
75
|
-
"@types/node": "
|
|
76
|
-
"@types/react": "19.
|
|
77
|
-
"cspell": "
|
|
78
|
-
"eslint": "
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
"stylelint": "16.
|
|
86
|
-
"typescript": "5.
|
|
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": "
|
|
90
|
-
"eslint": "
|
|
91
|
-
"npm-package-json-lint": "
|
|
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.
|
|
114
|
+
"packageManager": "yarn@4.12.0",
|
|
113
115
|
"engines": {
|
|
114
116
|
"node": ">=20.0.0"
|
|
115
117
|
},
|
package/src/cspell/base.txt
CHANGED
|
@@ -1,19 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
+
})
|