@dvukovic/style-guide 0.3.99 → 0.3.101
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 +38 -14
- package/package.json +2 -2
- package/src/eslint/index.js +14 -2
- package/src/eslint/plugins/eslint.js +0 -1
- package/src/eslint/plugins/promise.js +0 -1
- package/src/eslint/plugins/sonarjs.js +0 -10
- package/src/eslint/types.js +0 -19
package/README.md
CHANGED
|
@@ -67,7 +67,7 @@ Add these scripts to your `package.json`:
|
|
|
67
67
|
"lint:eslint": "eslint . --cache --concurrency=auto",
|
|
68
68
|
"lint:fix": "yarn lint:eslint --fix && yarn lint:prettier --write && yarn lint:stylelint --fix && yarn lint:spell",
|
|
69
69
|
"lint:prettier": "prettier --check --cache .",
|
|
70
|
-
"lint:spell": "cspell --
|
|
70
|
+
"lint:spell": "cspell --no-progress --no-summary --unique '**'",
|
|
71
71
|
"lint:stylelint": "stylelint ./**/*.css --cache",
|
|
72
72
|
"test": "vitest run"
|
|
73
73
|
}
|
|
@@ -112,26 +112,50 @@ export default customDefineConfig(
|
|
|
112
112
|
|
|
113
113
|
## Prettier Configuration
|
|
114
114
|
|
|
115
|
-
```js
|
|
116
|
-
import {
|
|
117
|
-
|
|
118
|
-
export default prettier
|
|
119
|
-
```
|
|
115
|
+
```js prettier.config.ts
|
|
116
|
+
import type { Config } from "prettier"
|
|
120
117
|
|
|
121
|
-
|
|
118
|
+
import core from "@dvukovic/style-guide/src/prettier/configs/core.js"
|
|
122
119
|
|
|
123
|
-
|
|
124
|
-
|
|
120
|
+
const config: Config = {
|
|
121
|
+
...core,
|
|
122
|
+
}
|
|
125
123
|
|
|
126
|
-
export default
|
|
124
|
+
export default config
|
|
127
125
|
```
|
|
128
126
|
|
|
129
|
-
##
|
|
127
|
+
## Stylelint Configuration
|
|
130
128
|
|
|
131
|
-
```js
|
|
132
|
-
|
|
129
|
+
```js stylelint.config.js
|
|
130
|
+
/** @type {import("stylelint").Config} */
|
|
131
|
+
module.exports = {
|
|
132
|
+
extends: "@dvukovic/style-guide/src/stylelint/configs/core",
|
|
133
|
+
allowEmptyInput: true,
|
|
134
|
+
}
|
|
135
|
+
```
|
|
133
136
|
|
|
134
|
-
|
|
137
|
+
## Cspell Configuration
|
|
138
|
+
|
|
139
|
+
```cspell.config.js
|
|
140
|
+
/** @type {import("cspell").FileSettings} */
|
|
141
|
+
module.exports = {
|
|
142
|
+
cache: {
|
|
143
|
+
cacheLocation: "./node_modules/.cache/cspell",
|
|
144
|
+
useCache: true,
|
|
145
|
+
},
|
|
146
|
+
caseSensitive: false,
|
|
147
|
+
ignorePaths: [],
|
|
148
|
+
dictionaries: ["shared"],
|
|
149
|
+
dictionaryDefinitions: [
|
|
150
|
+
{
|
|
151
|
+
name: "shared",
|
|
152
|
+
path: "./node_modules/@dvukovic/style-guide/src/cspell/base.txt",
|
|
153
|
+
},
|
|
154
|
+
],
|
|
155
|
+
useGitignore: true,
|
|
156
|
+
ignoreWords: [
|
|
157
|
+
],
|
|
158
|
+
}
|
|
135
159
|
```
|
|
136
160
|
|
|
137
161
|
## License
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dvukovic/style-guide",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.101",
|
|
4
4
|
"description": "My own style guide",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"lint:eslint": "eslint . --cache --concurrency=auto",
|
|
24
24
|
"lint:fix": "yarn lint:eslint --fix && yarn lint:prettier --write && yarn lint:stylelint --fix && yarn lint:spell",
|
|
25
25
|
"lint:prettier": "prettier --check --cache .",
|
|
26
|
-
"lint:spell": "cspell --
|
|
26
|
+
"lint:spell": "cspell --no-progress --no-summary --unique '**'",
|
|
27
27
|
"lint:stylelint": "stylelint ./**/*.css --cache",
|
|
28
28
|
"release": "release-it",
|
|
29
29
|
"test": "vitest run"
|
package/src/eslint/index.js
CHANGED
|
@@ -9,7 +9,20 @@ import { defineConfig, globalIgnores } from "eslint/config"
|
|
|
9
9
|
* @returns {Array} ESLint configuration
|
|
10
10
|
*/
|
|
11
11
|
export function customDefineConfig(ignores, configs = []) {
|
|
12
|
-
return defineConfig(
|
|
12
|
+
return defineConfig(
|
|
13
|
+
globalIgnores([
|
|
14
|
+
"node_modules",
|
|
15
|
+
"./*.js",
|
|
16
|
+
"./*.ts",
|
|
17
|
+
"./*.cjs",
|
|
18
|
+
"./*.mjs",
|
|
19
|
+
"./*.config.js",
|
|
20
|
+
"./*.config.cjs",
|
|
21
|
+
"./*.config.mjs",
|
|
22
|
+
...ignores,
|
|
23
|
+
]),
|
|
24
|
+
...configs,
|
|
25
|
+
)
|
|
13
26
|
}
|
|
14
27
|
|
|
15
28
|
export * from "./configs/core.js"
|
|
@@ -19,7 +32,6 @@ export * from "./configs/next.js"
|
|
|
19
32
|
export * from "./configs/node.js"
|
|
20
33
|
export * from "./configs/playwright.js"
|
|
21
34
|
export * from "./configs/react.js"
|
|
22
|
-
export * from "./configs/storybook.js"
|
|
23
35
|
export * from "./configs/typescript.js"
|
|
24
36
|
export * from "./configs/typescript-strict.js"
|
|
25
37
|
export * from "./configs/vitest.js"
|
|
@@ -30,7 +30,6 @@ export const eslint = {
|
|
|
30
30
|
"func-names": ["error", "as-needed"],
|
|
31
31
|
"func-style": ["error", "declaration", { allowArrowFunctions: true }],
|
|
32
32
|
"id-length": ["error", { exceptions: ["x", "y", "z"], min: 2, properties: "never" }],
|
|
33
|
-
"logical-assignment-operators": ["error", "never"],
|
|
34
33
|
"max-classes-per-file": ["error", 1],
|
|
35
34
|
"max-depth": ["error", 4],
|
|
36
35
|
"max-lines": ["error", 1200],
|
|
@@ -41,7 +41,6 @@ export const sonarjs = {
|
|
|
41
41
|
"sonarjs/class-name": "error",
|
|
42
42
|
"sonarjs/class-prototype": "error",
|
|
43
43
|
"sonarjs/code-eval": "error",
|
|
44
|
-
"sonarjs/cognitive-complexity": "error",
|
|
45
44
|
"sonarjs/comma-or-logical-or-case": "error",
|
|
46
45
|
"sonarjs/comment-regex": "error",
|
|
47
46
|
"sonarjs/concise-regex": "error",
|
|
@@ -54,7 +53,6 @@ export const sonarjs = {
|
|
|
54
53
|
"sonarjs/cookies": "error",
|
|
55
54
|
"sonarjs/cors": "error",
|
|
56
55
|
"sonarjs/csrf": "error",
|
|
57
|
-
"sonarjs/cyclomatic-complexity": "error",
|
|
58
56
|
"sonarjs/deprecation": "error",
|
|
59
57
|
"sonarjs/destructuring-assignment-syntax": "error",
|
|
60
58
|
"sonarjs/different-types-comparison": "error",
|
|
@@ -63,13 +61,11 @@ export const sonarjs = {
|
|
|
63
61
|
"sonarjs/disabled-timeout": "error",
|
|
64
62
|
"sonarjs/dns-prefetching": "error",
|
|
65
63
|
"sonarjs/duplicates-in-character-class": "error",
|
|
66
|
-
"sonarjs/elseif-without-else": "error",
|
|
67
64
|
"sonarjs/empty-string-repetition": "error",
|
|
68
65
|
"sonarjs/encryption": "error",
|
|
69
66
|
"sonarjs/encryption-secure-mode": "error",
|
|
70
67
|
"sonarjs/enforce-trailing-comma": "error",
|
|
71
68
|
"sonarjs/existing-groups": "error",
|
|
72
|
-
"sonarjs/expression-complexity": "error",
|
|
73
69
|
"sonarjs/file-permissions": "error",
|
|
74
70
|
"sonarjs/file-uploads": "error",
|
|
75
71
|
"sonarjs/fixme-tag": "error",
|
|
@@ -77,7 +73,6 @@ export const sonarjs = {
|
|
|
77
73
|
"sonarjs/for-loop-increment-sign": "error",
|
|
78
74
|
"sonarjs/frame-ancestors": "error",
|
|
79
75
|
"sonarjs/function-inside-loop": "error",
|
|
80
|
-
"sonarjs/function-return-type": "error",
|
|
81
76
|
"sonarjs/future-reserved-words": "error",
|
|
82
77
|
"sonarjs/generator-without-yield": "error",
|
|
83
78
|
"sonarjs/hashing": "error",
|
|
@@ -92,7 +87,6 @@ export const sonarjs = {
|
|
|
92
87
|
"sonarjs/label-position": "error",
|
|
93
88
|
"sonarjs/link-with-target-blank": "error",
|
|
94
89
|
"sonarjs/max-lines": "error",
|
|
95
|
-
"sonarjs/max-lines-per-function": "error",
|
|
96
90
|
"sonarjs/max-switch-cases": "error",
|
|
97
91
|
"sonarjs/max-union-size": "error",
|
|
98
92
|
"sonarjs/misplaced-loop-counter": "error",
|
|
@@ -144,7 +138,6 @@ export const sonarjs = {
|
|
|
144
138
|
"sonarjs/no-implicit-global": "error",
|
|
145
139
|
"sonarjs/no-in-misuse": "error",
|
|
146
140
|
"sonarjs/no-incomplete-assertions": "error",
|
|
147
|
-
"sonarjs/no-inconsistent-returns": "error",
|
|
148
141
|
"sonarjs/no-incorrect-string-concat": "error",
|
|
149
142
|
"sonarjs/no-internal-api-use": "error",
|
|
150
143
|
"sonarjs/no-intrusive-permissions": "error",
|
|
@@ -160,7 +153,6 @@ export const sonarjs = {
|
|
|
160
153
|
"sonarjs/no-mixed-content": "error",
|
|
161
154
|
"sonarjs/no-nested-assignment": "error",
|
|
162
155
|
"sonarjs/no-nested-conditional": "error",
|
|
163
|
-
"sonarjs/no-nested-functions": "error",
|
|
164
156
|
"sonarjs/no-nested-incdec": "error",
|
|
165
157
|
"sonarjs/no-nested-switch": "error",
|
|
166
158
|
"sonarjs/no-nested-template-literals": "error",
|
|
@@ -192,7 +184,6 @@ export const sonarjs = {
|
|
|
192
184
|
"sonarjs/no-unthrown-error": "error",
|
|
193
185
|
"sonarjs/no-unused-collection": "error",
|
|
194
186
|
"sonarjs/no-unused-function-argument": "error",
|
|
195
|
-
"sonarjs/no-unused-vars": "error",
|
|
196
187
|
"sonarjs/no-use-of-empty-return-value": "error",
|
|
197
188
|
"sonarjs/no-useless-catch": "error",
|
|
198
189
|
"sonarjs/no-useless-increment": "error",
|
|
@@ -227,7 +218,6 @@ export const sonarjs = {
|
|
|
227
218
|
"sonarjs/redundant-type-aliases": "error",
|
|
228
219
|
"sonarjs/regex-complexity": "error",
|
|
229
220
|
"sonarjs/session-regeneration": "error",
|
|
230
|
-
"sonarjs/shorthand-property-grouping": "error",
|
|
231
221
|
"sonarjs/single-char-in-character-classes": "error",
|
|
232
222
|
"sonarjs/single-character-alternation": "error",
|
|
233
223
|
"sonarjs/sockets": "error",
|
package/src/eslint/types.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @typedef {Object} ConfigOptions
|
|
3
|
-
* @property {boolean} [replace=false] - If true, replaces default config entirely with custom
|
|
4
|
-
* configs. Default is `false`
|
|
5
|
-
* @property {any[]} [configs=[]] - Additional configs to append or use as replacement. Default is
|
|
6
|
-
* `[]`
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @typedef {Object} TypeScriptConfigOptions
|
|
11
|
-
* @property {boolean} [replace=false] - If true, replaces default config entirely with custom
|
|
12
|
-
* configs. Default is `false`
|
|
13
|
-
* @property {any[]} [configs=[]] - Additional configs to append or use as replacement. Default is
|
|
14
|
-
* `[]`
|
|
15
|
-
* @property {string} [tsconfigPath="./tsconfig.json"] - Path to tsconfig.json file. Default is
|
|
16
|
-
* `"./tsconfig.json"`
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
export {}
|