@10stars/config 9.0.2 → 9.1.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.
- package/package.json +6 -6
- package/src/link-packages.ts +5 -1
- package/.eslintrc.js +0 -249
- package/.prettierrc.js +0 -38
- package/commitlint.config.js +0 -29
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"name": "@10stars/config",
|
|
7
|
-
"version": "9.0
|
|
7
|
+
"version": "9.1.0",
|
|
8
8
|
"author": "10stars.dev <web@alexandrov.co> (https://alexandrov.co)",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"module": "./src/index.ts",
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"@types/lodash": "^4.0.0",
|
|
30
30
|
"@types/node": "^20.0.0",
|
|
31
31
|
"@types/react": "^18.0.0",
|
|
32
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
33
|
-
"@typescript-eslint/parser": "^
|
|
32
|
+
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
|
33
|
+
"@typescript-eslint/parser": "^6.0.0",
|
|
34
34
|
"builtin-modules": "^3.3.0",
|
|
35
|
-
"esbuild": "~0.18.
|
|
35
|
+
"esbuild": "~0.18.11",
|
|
36
36
|
"tsx": "^3.8.0",
|
|
37
37
|
"eslint": "^8.0.0",
|
|
38
38
|
"eslint-config-prettier": "^8.0.0",
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"eslint-plugin-sort-keys-fix": "^1.0.0",
|
|
44
44
|
"eslint-watch": "^8.0.0",
|
|
45
45
|
"husky": "^8.0.0",
|
|
46
|
-
"prettier": "^
|
|
46
|
+
"prettier": "^3.0.0",
|
|
47
47
|
"type-fest": "^3.0.0",
|
|
48
|
-
"typescript": "^5.1.
|
|
48
|
+
"typescript": "^5.1.6"
|
|
49
49
|
}
|
|
50
50
|
}
|
package/src/link-packages.ts
CHANGED
|
@@ -22,6 +22,8 @@ export const linkPackages = async (
|
|
|
22
22
|
cwd: string,
|
|
23
23
|
packagesToLink: { relativePath: string; isMonorepo?: boolean }[],
|
|
24
24
|
) => {
|
|
25
|
+
console.info(`Linking local packages`)
|
|
26
|
+
|
|
25
27
|
const linkPackage = async (pathPkg: string) => {
|
|
26
28
|
const pkgJson: TF.PackageJson = await import(
|
|
27
29
|
path.join(pathPkg, `package.json`)
|
|
@@ -64,5 +66,7 @@ export const linkPackages = async (
|
|
|
64
66
|
}
|
|
65
67
|
}
|
|
66
68
|
|
|
67
|
-
|
|
69
|
+
await Promise.all(promises)
|
|
70
|
+
|
|
71
|
+
console.info(`Successfully linked local packages!`)
|
|
68
72
|
}
|
package/.eslintrc.js
DELETED
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
const builtinModules = require("builtin-modules")
|
|
2
|
-
/**
|
|
3
|
-
* @todo
|
|
4
|
-
* - prohibit "whiteSpace" style rule
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* @return [0, 0.25, -0.25, 0.5, -0.5, 0.75, -0.75, 1, -1, ..., 10, -10]
|
|
8
|
-
*/
|
|
9
|
-
const allowedMagicNumbers = (() => {
|
|
10
|
-
const magicNumbers = []
|
|
11
|
-
const max = 10
|
|
12
|
-
|
|
13
|
-
for (let i = 0; i < max + 1; i++) {
|
|
14
|
-
if (i === max) {
|
|
15
|
-
magicNumbers.push(i, -i)
|
|
16
|
-
continue
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
if (i === -i) magicNumbers.push(i)
|
|
20
|
-
else magicNumbers.push(i, -i)
|
|
21
|
-
|
|
22
|
-
const numOfDecimals = 4
|
|
23
|
-
const decimalPoint = 1 / numOfDecimals
|
|
24
|
-
for (let b = 1; b < numOfDecimals; b++) {
|
|
25
|
-
const decimal = i + b * decimalPoint
|
|
26
|
-
magicNumbers.push(decimal, -decimal)
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return magicNumbers
|
|
31
|
-
})()
|
|
32
|
-
|
|
33
|
-
const reactUseHooks = [
|
|
34
|
-
`useUpdateEffect`,
|
|
35
|
-
`useIsomorphicLayoutEffect`,
|
|
36
|
-
`useDeepCompareEffect`,
|
|
37
|
-
`useShallowCompareEffect`,
|
|
38
|
-
`useCustomCompareEffect`,
|
|
39
|
-
]
|
|
40
|
-
|
|
41
|
-
const type = {
|
|
42
|
-
ignore: 0,
|
|
43
|
-
warning: 1,
|
|
44
|
-
error: 2,
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
module.exports = {
|
|
48
|
-
root: true, // https://eslint.org/docs/latest/use/configure/configuration-files#using-configuration-files
|
|
49
|
-
parser: `@typescript-eslint/parser`, // Specifies the ESLint parser
|
|
50
|
-
ignorePatterns: [`**/node_modules`, `**/.git`, `**/dist`, `**/tmp`],
|
|
51
|
-
plugins: [
|
|
52
|
-
`@typescript-eslint`,
|
|
53
|
-
`import`,
|
|
54
|
-
`react`,
|
|
55
|
-
`@10stars/react-hooks`, // https://reactjs.org/docs/hooks-rules.html#eslint-plugin
|
|
56
|
-
`regexp`,
|
|
57
|
-
`simple-import-sort`,
|
|
58
|
-
`sort-keys-fix`,
|
|
59
|
-
// 'prettier' commented as we don't want to run prettier through eslint because of performance
|
|
60
|
-
],
|
|
61
|
-
env: {
|
|
62
|
-
browser: true,
|
|
63
|
-
jest: true,
|
|
64
|
-
},
|
|
65
|
-
extends: [
|
|
66
|
-
`eslint:recommended`,
|
|
67
|
-
`plugin:@typescript-eslint/recommended`,
|
|
68
|
-
`plugin:@typescript-eslint/recommended-requiring-type-checking`,
|
|
69
|
-
`plugin:react/recommended`,
|
|
70
|
-
`plugin:@10stars/react-hooks/recommended`,
|
|
71
|
-
`plugin:regexp/recommended`,
|
|
72
|
-
|
|
73
|
-
// We use only few custom rules from the import plugin and we override some aspects with simple-import-sort
|
|
74
|
-
// "plugin:import/typescript",
|
|
75
|
-
// "plugin:import/warnings",
|
|
76
|
-
// "plugin:import/errors",
|
|
77
|
-
`prettier`, // see: https://github.com/prettier/eslint-config-prettier
|
|
78
|
-
],
|
|
79
|
-
parserOptions: {
|
|
80
|
-
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
|
|
81
|
-
sourceType: `module`, // Allows for the use of imports
|
|
82
|
-
ecmaFeatures: {
|
|
83
|
-
jsx: true, // Allows for the parsing of JSX
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
settings: {
|
|
87
|
-
"import/parsers": { "@typescript-eslint/parser": [`.ts`, `.tsx`] },
|
|
88
|
-
"import/extensions": [`.ts`, `.tsx`, `.js`, `.jsx`],
|
|
89
|
-
react: {
|
|
90
|
-
version: `18.0.0`,
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
rules: {
|
|
94
|
-
/**
|
|
95
|
-
* ESLint core rules
|
|
96
|
-
*/
|
|
97
|
-
"no-case-declarations": type.ignore, // TypeScript shows us error, if the variable is reused in the same scope, so this rule is not applicable
|
|
98
|
-
/**
|
|
99
|
-
* eslint-plugin-import @see https://github.com/benmosher/eslint-plugin-import
|
|
100
|
-
*/
|
|
101
|
-
"import/order": type.ignore, // turn off in favor of eslint-plugin-simple-import-sort
|
|
102
|
-
"import/no-unresolved": type.ignore,
|
|
103
|
-
"import/no-duplicates": type.warning,
|
|
104
|
-
"import/no-nodejs-modules": [
|
|
105
|
-
type.error,
|
|
106
|
-
{
|
|
107
|
-
allow: builtinModules.flatMap((v) => [
|
|
108
|
-
`node:${v}`,
|
|
109
|
-
`node:${v}/promises`,
|
|
110
|
-
]),
|
|
111
|
-
},
|
|
112
|
-
],
|
|
113
|
-
/**
|
|
114
|
-
* eslint-plugin-simple-import-sort
|
|
115
|
-
*/
|
|
116
|
-
"sort-imports": type.ignore, // we use eslint-plugin-import instead
|
|
117
|
-
"simple-import-sort/imports": type.warning,
|
|
118
|
-
"simple-import-sort/exports": type.warning,
|
|
119
|
-
/**
|
|
120
|
-
* React
|
|
121
|
-
*/
|
|
122
|
-
"react/display-name": type.ignore,
|
|
123
|
-
"react/no-children-prop": type.ignore,
|
|
124
|
-
/** we ignore CSS, because we use Emotion @see https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unknown-property.md#rule-options */
|
|
125
|
-
"react/no-unknown-property": [type.error, { ignore: [`css`] }],
|
|
126
|
-
"react/prop-types": type.ignore,
|
|
127
|
-
"react/react-in-jsx-scope": type.ignore,
|
|
128
|
-
"react/jsx-filename-extension": [
|
|
129
|
-
type.warning,
|
|
130
|
-
{ extensions: [`.jsx`, `.tsx`] },
|
|
131
|
-
], // also want to use with ".tsx"
|
|
132
|
-
"react/no-invalid-html-attribute": type.error,
|
|
133
|
-
"react/prefer-stateless-function": type.error,
|
|
134
|
-
"react/jsx-boolean-value": [type.warning, "never"],
|
|
135
|
-
"react/jsx-curly-brace-presence": [type.warning, "always"],
|
|
136
|
-
"react/jsx-fragments": type.warning,
|
|
137
|
-
"react/jsx-no-bind": type.warning,
|
|
138
|
-
"react/jsx-no-constructed-context-values": type.warning,
|
|
139
|
-
"react/jsx-no-script-url": [
|
|
140
|
-
type.error,
|
|
141
|
-
[
|
|
142
|
-
{ name: "Link", props: ["to"] },
|
|
143
|
-
{ name: "NavLink", props: ["to"] },
|
|
144
|
-
{ name: "a", props: ["href", "to"] },
|
|
145
|
-
],
|
|
146
|
-
],
|
|
147
|
-
"react/jsx-no-useless-fragment": type.warning,
|
|
148
|
-
"react/jsx-no-target-blank": type.error,
|
|
149
|
-
"react/jsx-sort-props": type.warning,
|
|
150
|
-
/**
|
|
151
|
-
* Hooks
|
|
152
|
-
*/
|
|
153
|
-
"@10stars/react-hooks/exhaustive-deps": [
|
|
154
|
-
type.warning,
|
|
155
|
-
{
|
|
156
|
-
additionalHooks: `(${reactUseHooks.join(`|`)})`,
|
|
157
|
-
ignoreThisDependency: `always`,
|
|
158
|
-
},
|
|
159
|
-
],
|
|
160
|
-
/**
|
|
161
|
-
* TypeScript
|
|
162
|
-
* List of ignored (not recommended) rules we also explored:
|
|
163
|
-
* - @typescript-eslint/consistent-type-assertions
|
|
164
|
-
* - @typescript-eslint/explicit-module-boundary-types
|
|
165
|
-
* - @typescript-eslint/no-parameter-properties
|
|
166
|
-
* - @typescript-eslint/no-require-imports
|
|
167
|
-
* - @typescript-eslint/no-type-alias
|
|
168
|
-
* - @typescript-eslint/no-unnecessary-condition
|
|
169
|
-
* - @typescript-eslint/strict-boolean-expressions // doesn't work well
|
|
170
|
-
*/
|
|
171
|
-
// disabled recommended rules
|
|
172
|
-
"@typescript-eslint/no-unused-vars": type.ignore, // removed by bundler, so it shouldn't be a rule
|
|
173
|
-
"@typescript-eslint/no-empty-function": type.ignore, // used for prototyping
|
|
174
|
-
"@typescript-eslint/no-explicit-any": type.ignore,
|
|
175
|
-
"@typescript-eslint/ban-types": type.ignore,
|
|
176
|
-
// ---- we ignore these "no-unsafe-*" as it noticeably slows down the code writing
|
|
177
|
-
"@typescript-eslint/no-unsafe-assignment": type.ignore,
|
|
178
|
-
"@typescript-eslint/no-unsafe-member-access": type.ignore,
|
|
179
|
-
"@typescript-eslint/no-unsafe-return": type.ignore,
|
|
180
|
-
"@typescript-eslint/no-non-null-assertion": type.ignore, // sometimes TS incorrectly asserts, so there's a need to override
|
|
181
|
-
"@typescript-eslint/unbound-method": type.ignore,
|
|
182
|
-
// other
|
|
183
|
-
quotes: type.ignore,
|
|
184
|
-
"@typescript-eslint/array-type": [type.warning, { default: `array` }],
|
|
185
|
-
"@typescript-eslint/quotes": [type.warning, `backtick`],
|
|
186
|
-
"@typescript-eslint/consistent-type-definitions": [
|
|
187
|
-
type.warning, // @see https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#differences-between-type-aliases-and-interfaces
|
|
188
|
-
`interface`, // VSCode's Code lens can only highlight use of properties in "interface" definitions
|
|
189
|
-
],
|
|
190
|
-
"no-magic-numbers": type.ignore,
|
|
191
|
-
"@typescript-eslint/no-magic-numbers": [
|
|
192
|
-
type.warning,
|
|
193
|
-
{
|
|
194
|
-
ignore: allowedMagicNumbers,
|
|
195
|
-
ignoreTypeIndexes: true,
|
|
196
|
-
ignoreReadonlyClassProperties: true,
|
|
197
|
-
ignoreNumericLiteralTypes: true,
|
|
198
|
-
ignoreEnums: true,
|
|
199
|
-
},
|
|
200
|
-
],
|
|
201
|
-
"@typescript-eslint/no-unnecessary-type-arguments": type.warning,
|
|
202
|
-
"@typescript-eslint/unified-signatures": type.warning,
|
|
203
|
-
// string
|
|
204
|
-
"@typescript-eslint/prefer-string-starts-ends-with": type.warning,
|
|
205
|
-
// RegExp
|
|
206
|
-
"@typescript-eslint/prefer-regexp-exec": type.warning,
|
|
207
|
-
// array
|
|
208
|
-
"@typescript-eslint/prefer-includes": type.warning,
|
|
209
|
-
"@typescript-eslint/require-array-sort-compare": type.warning,
|
|
210
|
-
// loops
|
|
211
|
-
"@typescript-eslint/prefer-for-of": type.warning,
|
|
212
|
-
// promises
|
|
213
|
-
"@typescript-eslint/no-misused-promises": [
|
|
214
|
-
type.warning,
|
|
215
|
-
{ checksVoidReturn: false },
|
|
216
|
-
],
|
|
217
|
-
"@typescript-eslint/no-floating-promises": [
|
|
218
|
-
type.warning,
|
|
219
|
-
{ ignoreVoid: true },
|
|
220
|
-
],
|
|
221
|
-
// namespace
|
|
222
|
-
"@typescript-eslint/no-unnecessary-qualifier": type.warning,
|
|
223
|
-
// for classes
|
|
224
|
-
"@typescript-eslint/no-extraneous-class": type.warning,
|
|
225
|
-
"@typescript-eslint/explicit-member-accessibility": type.warning,
|
|
226
|
-
"@typescript-eslint/member-ordering": [
|
|
227
|
-
type.warning,
|
|
228
|
-
{
|
|
229
|
-
default: [
|
|
230
|
-
`public-static-field`,
|
|
231
|
-
`public-instance-field`,
|
|
232
|
-
`public-constructor`,
|
|
233
|
-
`private-static-field`,
|
|
234
|
-
`private-instance-field`,
|
|
235
|
-
`private-constructor`,
|
|
236
|
-
`public-instance-method`,
|
|
237
|
-
`protected-instance-method`,
|
|
238
|
-
`private-instance-method`,
|
|
239
|
-
],
|
|
240
|
-
},
|
|
241
|
-
],
|
|
242
|
-
"no-useless-constructor": type.ignore,
|
|
243
|
-
"@typescript-eslint/no-useless-constructor": type.warning,
|
|
244
|
-
/**
|
|
245
|
-
* Regex
|
|
246
|
-
*/
|
|
247
|
-
"regexp/no-useless-escape": type.warning,
|
|
248
|
-
},
|
|
249
|
-
}
|
package/.prettierrc.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
parser: "typescript",
|
|
3
|
-
arrowParens: "always",
|
|
4
|
-
trailingComma: "all",
|
|
5
|
-
tabWidth: 2,
|
|
6
|
-
semi: false,
|
|
7
|
-
singleQuote: false,
|
|
8
|
-
overrides: [
|
|
9
|
-
{
|
|
10
|
-
files: "*.yml",
|
|
11
|
-
options: { parser: "yaml" },
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
files: "*.yaml",
|
|
15
|
-
options: { parser: "yaml" },
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
files: "*.md",
|
|
19
|
-
options: { parser: "markdown" },
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
files: "*.mdx",
|
|
23
|
-
options: { parser: "mdx" },
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
files: "*.json",
|
|
27
|
-
options: { parser: "json" },
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
files: "*.html",
|
|
31
|
-
options: { parser: "html" },
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
files: "*.css",
|
|
35
|
-
options: { parser: "css" },
|
|
36
|
-
},
|
|
37
|
-
],
|
|
38
|
-
}
|
package/commitlint.config.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
extends: [`@commitlint/config-conventional`],
|
|
3
|
-
/**
|
|
4
|
-
* For explanation on how to write rules @see https://commitlint.js.org/#/reference-rules
|
|
5
|
-
*/
|
|
6
|
-
rules: {
|
|
7
|
-
"body-leading-blank": [1, `always`],
|
|
8
|
-
"footer-leading-blank": [1, `always`],
|
|
9
|
-
"header-max-length": [2, `always`, 72],
|
|
10
|
-
"scope-case": [2, `always`, `lower-case`],
|
|
11
|
-
"subject-case": [2, `never`, [`start-case`, `pascal-case`, `upper-case`]],
|
|
12
|
-
"subject-empty": [2, `never`],
|
|
13
|
-
"subject-full-stop": [2, `never`, `.`],
|
|
14
|
-
"type-case": [2, `always`, `upper-case`],
|
|
15
|
-
"type-empty": [2, `never`],
|
|
16
|
-
"type-enum": [
|
|
17
|
-
2,
|
|
18
|
-
`always`,
|
|
19
|
-
[
|
|
20
|
-
`ADDED`, // new features
|
|
21
|
-
`CHANGED`, // changes in existing functionality
|
|
22
|
-
`DEPRECATED`, // soon-to-be removed features
|
|
23
|
-
`FIXED`, // any bug fixes
|
|
24
|
-
`REMOVED`, // removed features
|
|
25
|
-
`SECURITY`, // in case of vulnerabilities
|
|
26
|
-
],
|
|
27
|
-
],
|
|
28
|
-
},
|
|
29
|
-
}
|