@tsofist/web-buddy 2.0.0-next.10 → 2.0.0-next.11
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/lib/eslint/config.js +9 -1
- package/lib/eslint/config.shared.rules.js +1 -1
- package/lib/eslint/config.typescript.d.ts +2 -2
- package/lib/eslint/config.typescript.rules.js +25 -1
- package/lib/eslint/config.vue.d.ts +2 -2
- package/lib/eslint/config.yaml.d.ts +2 -2
- package/lib/eslint/ignores.d.ts +4 -0
- package/lib/eslint/ignores.js +13 -0
- package/lib/types.d.ts +3 -2
- package/package.json +17 -6
package/lib/eslint/config.js
CHANGED
|
@@ -30,7 +30,15 @@ export function createWebBuddyESLintConfigChain() {
|
|
|
30
30
|
}
|
|
31
31
|
function createWebBuddyESLintConfigGeneralChain() {
|
|
32
32
|
return [
|
|
33
|
-
{
|
|
33
|
+
{
|
|
34
|
+
linterOptions: {
|
|
35
|
+
reportUnusedDisableDirectives: 'error',
|
|
36
|
+
reportUnusedInlineConfigs: 'error',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
ignores: WebBuddyESLintIgnores,
|
|
41
|
+
},
|
|
34
42
|
{
|
|
35
43
|
plugins: {
|
|
36
44
|
'@stylistic': epStylistic,
|
|
@@ -57,7 +57,7 @@ export const WebBuddyESLintRulesShared = {
|
|
|
57
57
|
},
|
|
58
58
|
],
|
|
59
59
|
'no-restricted-syntax': [
|
|
60
|
-
'
|
|
60
|
+
'warn',
|
|
61
61
|
{
|
|
62
62
|
selector: "BinaryExpression[operator='==='][right.type='Identifier'][right.name='undefined']",
|
|
63
63
|
message: 'Do not compare directly to undefined. Use == null instead.',
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const WebBuddyESLintTypeScript:
|
|
1
|
+
import type { ESLintConfigChainItem } from '../types.js';
|
|
2
|
+
export declare const WebBuddyESLintTypeScript: ESLintConfigChainItem;
|
|
@@ -12,7 +12,16 @@ https://eslint.vuejs.org/rules/script-indent
|
|
|
12
12
|
|
|
13
13
|
*/
|
|
14
14
|
export const WebBuddyESLintTypeScriptRules = {
|
|
15
|
-
'@typescript-eslint/prefer-
|
|
15
|
+
'@typescript-eslint/prefer-optional-chain': 'off', // noisy
|
|
16
|
+
'@typescript-eslint/prefer-nullish-coalescing': [
|
|
17
|
+
'warn',
|
|
18
|
+
{
|
|
19
|
+
ignoreIfStatements: true,
|
|
20
|
+
ignorePrimitives: {
|
|
21
|
+
string: true,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
],
|
|
16
25
|
'@typescript-eslint/no-deprecated': 'warn',
|
|
17
26
|
'@typescript-eslint/no-empty-object-type': 'off', // harmful
|
|
18
27
|
'@typescript-eslint/consistent-indexed-object-style': 'off', // harmful
|
|
@@ -129,7 +138,22 @@ export const WebBuddyESLintTypeScriptRules = {
|
|
|
129
138
|
'error',
|
|
130
139
|
{ allowWithDecorator: true, allowStaticOnly: true },
|
|
131
140
|
],
|
|
141
|
+
'@typescript-eslint/dot-notation': [
|
|
142
|
+
'warn',
|
|
143
|
+
{
|
|
144
|
+
allowPattern: '^([_A-Z]+)$',
|
|
145
|
+
allowIndexSignaturePropertyAccess: true,
|
|
146
|
+
},
|
|
147
|
+
],
|
|
132
148
|
'@typescript-eslint/no-wrapper-object-types': 'error',
|
|
149
|
+
'@typescript-eslint/no-base-to-string': 'warn',
|
|
150
|
+
'@typescript-eslint/no-unused-expressions': [
|
|
151
|
+
'error',
|
|
152
|
+
{
|
|
153
|
+
allowShortCircuit: true,
|
|
154
|
+
},
|
|
155
|
+
],
|
|
156
|
+
'@typescript-eslint/no-unsafe-function-type': 'warn', // noisy
|
|
133
157
|
'@typescript-eslint/unified-signatures': 'off', // odd
|
|
134
158
|
'@typescript-eslint/no-unsafe-enum-comparison': 'off', // odd
|
|
135
159
|
'@typescript-eslint/no-duplicate-type-constituents': 'off', // odd
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ESLintConfigChainItem } from '../types.js';
|
|
2
2
|
/**
|
|
3
3
|
* @see https://github.com/oxc-project/oxc/issues/15761 TODO: oxc migration blocker
|
|
4
4
|
*/
|
|
5
|
-
export declare const WebBuddyESLintVue:
|
|
5
|
+
export declare const WebBuddyESLintVue: ESLintConfigChainItem;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const WebBuddyESLintYAML:
|
|
1
|
+
import type { ESLintConfigChainItem } from '../types.js';
|
|
2
|
+
export declare const WebBuddyESLintYAML: ESLintConfigChainItem;
|
package/lib/eslint/ignores.d.ts
CHANGED
|
@@ -1 +1,5 @@
|
|
|
1
|
+
import type { ESLintConfigChain, ESLintConfigChainItem } from '../types.js';
|
|
1
2
|
export declare const WebBuddyESLintIgnores: string[];
|
|
3
|
+
export declare function appendESLintIgnores(ignores: string[], chain: ESLintConfigChain, matcher?: typeof matchIgnores): ESLintConfigChain;
|
|
4
|
+
declare function matchIgnores(item: ESLintConfigChainItem): boolean;
|
|
5
|
+
export {};
|
package/lib/eslint/ignores.js
CHANGED
|
@@ -38,3 +38,16 @@ export const WebBuddyESLintIgnores = [
|
|
|
38
38
|
'./spec/*.openapi.json',
|
|
39
39
|
'./spec/*.dbml.json',
|
|
40
40
|
];
|
|
41
|
+
export function appendESLintIgnores(ignores, chain, matcher = matchIgnores) {
|
|
42
|
+
const list = chain.find(matcher)?.ignores;
|
|
43
|
+
if (list) {
|
|
44
|
+
list.push(...ignores);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
chain.unshift({ ignores });
|
|
48
|
+
}
|
|
49
|
+
return chain;
|
|
50
|
+
}
|
|
51
|
+
function matchIgnores(item) {
|
|
52
|
+
return Array.isArray(item.ignores) && item.files == null;
|
|
53
|
+
}
|
package/lib/types.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import type { ConfigWithExtends } from '@eslint/config-helpers';
|
|
1
2
|
import type { Linter } from 'eslint';
|
|
2
3
|
import type { defineConfig } from 'eslint/config';
|
|
3
4
|
export type WebBuddyESLintConfig = RO<ReturnType<ESLintDefineConfig>>;
|
|
4
5
|
export type ESLintRuleSet = Record<string, Linter.RuleEntry>;
|
|
5
|
-
export type
|
|
6
|
-
export type ESLintConfigChain =
|
|
6
|
+
export type ESLintConfigChainItem = ConfigWithExtends;
|
|
7
|
+
export type ESLintConfigChain = ConfigWithExtends[];
|
|
7
8
|
export type StylelintRuleSet = {
|
|
8
9
|
[rule in string]: null | boolean | [boolean, object];
|
|
9
10
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsofist/web-buddy",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.11",
|
|
4
4
|
"description": "Configuration basics for Linters, TypeScript, Semantic Release and others",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Andrew Berdnikov <tsofistgudmen@gmail.com>",
|
|
@@ -10,9 +10,10 @@
|
|
|
10
10
|
"build": "rm -rf lib && tsc -p tsconfig.build.json",
|
|
11
11
|
"format": "npm run lint:code -- --fix && npm run lint:style -- --fix",
|
|
12
12
|
"test": "npm run build && npm run lint",
|
|
13
|
-
"lint": "npm run lint:code && npm run lint:style",
|
|
13
|
+
"lint": "npm run lint:code && npm run lint:style && npm run lint:lock-file",
|
|
14
14
|
"lint:code": "WEB_BUDDY_LINT_STRICTER=1 eslint . --cache --cache-location .cache/",
|
|
15
15
|
"lint:style": "stylelint **/*.{htm,html,vue,css,scss,sass,pcss,postcss} --cache --cache-location .cache/ --allow-empty-input",
|
|
16
|
+
"lint:lock-file": "lockfile-lint",
|
|
16
17
|
"pkg:publish": "semantic-release --no-ci",
|
|
17
18
|
"pkg:publish-test": "semantic-release --no-ci --dry-run",
|
|
18
19
|
"pkg:clean": "rm -rf dist lib .coverage .cache",
|
|
@@ -38,6 +39,7 @@
|
|
|
38
39
|
"eslint-plugin-yml": "^3.8.1",
|
|
39
40
|
"globals": "^17.11.0",
|
|
40
41
|
"husky": "^9.1.7",
|
|
42
|
+
"lockfile-lint": "^5.0.1",
|
|
41
43
|
"postcss-html": "^2.0.0",
|
|
42
44
|
"prettier": "^3.9.6",
|
|
43
45
|
"semantic-release": "^25.0.9",
|
|
@@ -70,12 +72,21 @@
|
|
|
70
72
|
"engines": {
|
|
71
73
|
"node": ">=22.12"
|
|
72
74
|
},
|
|
73
|
-
"release": {
|
|
74
|
-
"extends": "./lib/semantic-release/config.github.js"
|
|
75
|
-
},
|
|
76
75
|
"keywords": [
|
|
77
76
|
"eslint",
|
|
78
77
|
"web-config",
|
|
79
78
|
"linting"
|
|
80
|
-
]
|
|
79
|
+
],
|
|
80
|
+
"release": {
|
|
81
|
+
"extends": "./lib/semantic-release/config.github.js"
|
|
82
|
+
},
|
|
83
|
+
"lockfile-lint": {
|
|
84
|
+
"type": "npm",
|
|
85
|
+
"path": "package-lock.json",
|
|
86
|
+
"allowedHosts": [
|
|
87
|
+
"npm"
|
|
88
|
+
],
|
|
89
|
+
"validateHttps": true,
|
|
90
|
+
"validateIntegrity": true
|
|
91
|
+
}
|
|
81
92
|
}
|