@chris.araneo/eslint-config 0.0.115 → 0.0.120
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 +9 -8
- package/dist/src/angular/angular-eslint-template.js +15 -15
- package/dist/src/angular/angular-eslint-template.js.map +1 -1
- package/dist/src/angular/angular-eslint.js +30 -30
- package/dist/src/angular/angular-eslint.js.map +1 -1
- package/dist/src/builder/append-config-when-defined.d.ts +1 -1
- package/dist/src/builder/append-config-when-defined.js +4 -3
- package/dist/src/builder/append-config-when-defined.js.map +1 -1
- package/dist/src/builder/append-cross-config-files-to-ignores.d.ts +2 -0
- package/dist/src/builder/append-cross-config-files-to-ignores.js +40 -0
- package/dist/src/builder/append-cross-config-files-to-ignores.js.map +1 -0
- package/dist/src/builder/config-builder.d.ts +4 -0
- package/dist/src/builder/config-builder.js +49 -14
- package/dist/src/builder/config-builder.js.map +1 -1
- package/dist/src/builder/get-config-value.d.ts +2 -2
- package/dist/src/builder/get-config-value.js +2 -1
- package/dist/src/builder/get-config-value.js.map +1 -1
- package/dist/src/builder/get-unique-config-files.d.ts +2 -0
- package/dist/src/builder/get-unique-config-files.js +10 -0
- package/dist/src/builder/get-unique-config-files.js.map +1 -0
- package/dist/src/builder/index.d.ts +1 -4
- package/dist/src/builder/index.js +1 -4
- package/dist/src/builder/index.js.map +1 -1
- package/dist/src/builder/is-config-key.d.ts +2 -0
- package/dist/src/builder/is-config-key.js +9 -0
- package/dist/src/builder/is-config-key.js.map +1 -0
- package/dist/src/interfaces.d.ts +39 -1
- package/dist/src/interfaces.js.map +1 -1
- package/dist/src/json/jsonc.js +62 -22
- package/dist/src/json/jsonc.js.map +1 -1
- package/dist/src/nx/index.d.ts +2 -2
- package/dist/src/nx/index.js +2 -2
- package/dist/src/nx/index.js.map +1 -1
- package/dist/src/nx/nx.d.ts +2 -1
- package/dist/src/nx/nx.js +14 -24
- package/dist/src/nx/nx.js.map +1 -1
- package/dist/src/typescript/eslint.js +38 -32
- package/dist/src/typescript/eslint.js.map +1 -1
- package/dist/src/typescript/index.js +17 -17
- package/dist/src/typescript/index.js.map +1 -1
- package/dist/src/typescript/simple-import-sort.js +12 -12
- package/dist/src/typescript/simple-import-sort.js.map +1 -1
- package/dist/src/typescript/stylistic.js +112 -111
- package/dist/src/typescript/stylistic.js.map +1 -1
- package/dist/src/typescript/typescript-eslint.js +214 -212
- package/dist/src/typescript/typescript-eslint.js.map +1 -1
- package/dist/src/typescript/unicorn.js +32 -31
- package/dist/src/typescript/unicorn.js.map +1 -1
- package/package.json +13 -12
- package/dist/src/builder/add-cross-config-off-rules.d.ts +0 -2
- package/dist/src/builder/add-cross-config-off-rules.js +0 -38
- package/dist/src/builder/add-cross-config-off-rules.js.map +0 -1
- package/dist/src/builder/create-off-rules-config.d.ts +0 -2
- package/dist/src/builder/create-off-rules-config.js +0 -11
- package/dist/src/builder/create-off-rules-config.js.map +0 -1
- package/dist/src/builder/disable-all-rules.d.ts +0 -2
- package/dist/src/builder/disable-all-rules.js +0 -12
- package/dist/src/builder/disable-all-rules.js.map +0 -1
- package/dist/src/builder/find-first-files.d.ts +0 -2
- package/dist/src/builder/find-first-files.js +0 -2
- package/dist/src/builder/find-first-files.js.map +0 -1
- package/dist/src/builder/get-configs-to-disable.d.ts +0 -3
- package/dist/src/builder/get-configs-to-disable.js +0 -6
- package/dist/src/builder/get-configs-to-disable.js.map +0 -1
package/README.md
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
<p align="center">
|
|
4
4
|
<img src="https://avatars.githubusercontent.com/u/6019716" alt="Official @eslint GitHub user avatar" width="256px" height="256px"/>
|
|
5
5
|
<br>
|
|
6
|
-
<a href="https://github.com/ChrisAraneo/eslint-config/blob/master/package.json"><img src="https://img.shields.io/badge/version-v0.0.
|
|
6
|
+
<a href="https://github.com/ChrisAraneo/eslint-config/blob/master/package.json"><img src="https://img.shields.io/badge/version-v0.0.120-blue" alt="version"></a>
|
|
7
7
|
<a href="https://github.com/ChrisAraneo/eslint-config/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="@chris.araneo/eslint-config is released under the MIT license."></a>
|
|
8
8
|
<a href="https://github.com/ChrisAraneo/eslint-config/actions/workflows/ci.yml"><img alt="GitHub CI Status" src="https://img.shields.io/github/actions/workflow/status/ChrisAraneo/eslint-config/ci.yml?label=CI&logo=GitHub"></a>
|
|
9
9
|
<br>
|
|
10
10
|
<br>
|
|
11
|
-
<em>
|
|
11
|
+
<em>ESLint shareable configuration for TypeScript, Angular, JSON, and Nx</em>
|
|
12
12
|
<br>
|
|
13
13
|
</p>
|
|
14
14
|
|
|
@@ -134,6 +134,7 @@ configBuilder()
|
|
|
134
134
|
```
|
|
135
135
|
|
|
136
136
|
- `sources` (_optional_) - array of glob patterns for Nx workspace files (default: `[]`)
|
|
137
|
+
- `rulesConfig` (_optional_) - object to configure individual Nx rule behaviour (e.g. `dependencyChecks`, `enforceModuleBoundaries`, `nxPluginChecks`)
|
|
137
138
|
|
|
138
139
|
### Ignored Files
|
|
139
140
|
|
|
@@ -159,13 +160,13 @@ Creates a new instance of the `ESLintConfigBuilder`.
|
|
|
159
160
|
|
|
160
161
|
#### Methods
|
|
161
162
|
|
|
162
|
-
- `
|
|
163
|
-
- `
|
|
164
|
-
- `
|
|
165
|
-
- `
|
|
166
|
-
- `
|
|
163
|
+
- `addTypeScriptConfig(options)`: add TypeScript configuration
|
|
164
|
+
- `addTypeScriptTestsConfig(options)`: add TypeScript test configuration
|
|
165
|
+
- `addAngularConfig(options)`: add Angular configuration
|
|
166
|
+
- `addJsonConfig(options)`: add JSON configuration
|
|
167
|
+
- `addNxConfig(options)`: add Nx configuration
|
|
167
168
|
- `addIgnored(options)`: add ignored files configuration
|
|
168
|
-
- `build(
|
|
169
|
+
- `build()`: build and return the final ESLint configuration
|
|
169
170
|
- `reset()`: reset the builder to its initial state
|
|
170
171
|
|
|
171
172
|
All `add*` methods return `this` for method chaining.
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import angular from 'angular-eslint';
|
|
2
|
-
import {
|
|
3
|
-
export const getAngularTemplatesConfigs = (templates) =>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
import { match } from 'ts-pattern';
|
|
3
|
+
export const getAngularTemplatesConfigs = (templates) => match(templates?.length ?? 0)
|
|
4
|
+
.with(0, () => [])
|
|
5
|
+
.otherwise(() => [
|
|
6
|
+
...angular.configs.templateAll.map((config) => ({
|
|
7
|
+
...config,
|
|
8
|
+
files: templates,
|
|
9
|
+
rules: {
|
|
10
|
+
...config.rules,
|
|
11
|
+
'@angular-eslint/template/i18n': 'off',
|
|
12
|
+
'@angular-eslint/template/no-call-expression': 'off',
|
|
13
|
+
'@angular-eslint/template/prefer-control-flow': 'off',
|
|
14
|
+
},
|
|
15
|
+
})),
|
|
16
|
+
]);
|
|
17
17
|
//# sourceMappingURL=angular-eslint-template.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"angular-eslint-template.js","sourceRoot":"/","sources":["src/angular/angular-eslint-template.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,gBAAgB,CAAC;AAErC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"angular-eslint-template.js","sourceRoot":"/","sources":["src/angular/angular-eslint-template.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,gBAAgB,CAAC;AAErC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,MAAM,CAAC,MAAM,0BAA0B,GAAG,CACxC,SAAoB,EACH,EAAE,CACnB,KAAK,CAAC,SAAS,EAAE,MAAM,IAAI,CAAC,CAAC;KAC1B,IAAI,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;KACjB,SAAS,CAAC,GAAG,EAAE,CAAC;IACf,GAAG,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,CAChC,CAAC,MAAM,EAAE,EAAE,CACT,CAAC;QACC,GAAG,MAAM;QACT,KAAK,EAAE,SAAS;QAChB,KAAK,EAAE;YACL,GAAG,MAAM,CAAC,KAAK;YACf,+BAA+B,EAAE,KAAK;YACtC,6CAA6C,EAAE,KAAK;YACpD,8CAA8C,EAAE,KAAK;SACtD;KACF,CAAkB,CACtB;CACF,CAAC,CAAC"}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import angular from 'angular-eslint';
|
|
2
|
-
import {
|
|
3
|
-
export const getAngularSourcesConfigs = (prefix, sources) =>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
2
|
+
import { match } from 'ts-pattern';
|
|
3
|
+
export const getAngularSourcesConfigs = (prefix, sources) => match(sources?.length ?? 0)
|
|
4
|
+
.with(0, () => [])
|
|
5
|
+
.otherwise(() => angular.configs.tsAll.map((config) => ({
|
|
6
|
+
...config,
|
|
7
|
+
files: sources,
|
|
8
|
+
rules: {
|
|
9
|
+
...config.rules,
|
|
10
|
+
'@angular-eslint/component-selector': [
|
|
11
|
+
'error',
|
|
12
|
+
{
|
|
13
|
+
prefix: prefix ?? 'app',
|
|
14
|
+
style: 'kebab-case',
|
|
15
|
+
type: 'element',
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
'@angular-eslint/directive-selector': [
|
|
19
|
+
'error',
|
|
20
|
+
{
|
|
21
|
+
prefix: prefix ?? 'app',
|
|
22
|
+
style: 'camelCase',
|
|
23
|
+
type: 'attribute',
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
'@angular-eslint/no-forward-ref': 'off',
|
|
27
|
+
'@angular-eslint/prefer-on-push-component-change-detection': 'off',
|
|
28
|
+
'@angular-eslint/prefer-output-emitter-ref': 'off',
|
|
29
|
+
'@angular-eslint/prefer-signals': 'off',
|
|
30
|
+
},
|
|
31
|
+
})));
|
|
32
32
|
//# sourceMappingURL=angular-eslint.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"angular-eslint.js","sourceRoot":"/","sources":["src/angular/angular-eslint.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,gBAAgB,CAAC;AAErC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"angular-eslint.js","sourceRoot":"/","sources":["src/angular/angular-eslint.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,gBAAgB,CAAC;AAErC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,MAAM,CAAC,MAAM,wBAAwB,GAAG,CACtC,MAAe,EACf,OAAkB,EACD,EAAE,CACnB,KAAK,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC,CAAC;KACxB,IAAI,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;KACjB,SAAS,CAAC,GAAG,EAAE,CACd,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CACvB,CAAC,MAAM,EAAE,EAAE,CACT,CAAC;IACC,GAAG,MAAM;IACT,KAAK,EAAE,OAAO;IACd,KAAK,EAAE;QACL,GAAG,MAAM,CAAC,KAAK;QACf,oCAAoC,EAAE;YACpC,OAAO;YACP;gBACE,MAAM,EAAE,MAAM,IAAI,KAAK;gBACvB,KAAK,EAAE,YAAY;gBACnB,IAAI,EAAE,SAAS;aAChB;SACF;QACD,oCAAoC,EAAE;YACpC,OAAO;YACP;gBACE,MAAM,EAAE,MAAM,IAAI,KAAK;gBACvB,KAAK,EAAE,WAAW;gBAClB,IAAI,EAAE,WAAW;aAClB;SACF;QACD,gCAAgC,EAAE,KAAK;QACvC,2DAA2D,EACzD,KAAK;QACP,2CAA2C,EAAE,KAAK;QAClD,gCAAgC,EAAE,KAAK;KACxC;CACF,CAAkB,CACtB,CACF,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Linter } from 'eslint';
|
|
2
|
-
export declare const appendConfigWhenDefined: (configs: Linter.Config[], config: Linter.Config | unknown) => Linter.Config[];
|
|
2
|
+
export declare const appendConfigWhenDefined: (configs: Linter.Config[] | undefined, config: Linter.Config | unknown) => Linter.Config[];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { isArray, isObject } from 'lodash-es';
|
|
2
|
+
import { match } from 'ts-pattern';
|
|
2
3
|
import { getKeys } from './get-keys.js';
|
|
3
|
-
export const appendConfigWhenDefined = (configs, config) => isObject(config) && !!getKeys(config).length && !isArray(config)
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
export const appendConfigWhenDefined = (configs, config) => match(isObject(config) && !!getKeys(config).length && !isArray(config))
|
|
5
|
+
.with(true, () => [...(configs ?? []), config])
|
|
6
|
+
.otherwise(() => [...(configs ?? [])]);
|
|
6
7
|
//# sourceMappingURL=append-config-when-defined.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"append-config-when-defined.js","sourceRoot":"/","sources":["src/builder/append-config-when-defined.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"append-config-when-defined.js","sourceRoot":"/","sources":["src/builder/append-config-when-defined.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,OAAoC,EACpC,MAA+B,EACd,EAAE,CACnB,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;KACpE,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;KAC9C,SAAS,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAiC,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { chain, cloneDeep, isEmpty } from 'lodash-es';
|
|
2
|
+
import { JSONS, NX, SOURCES, TEMPLATES, TESTS, } from '../interfaces.js';
|
|
3
|
+
import { getConfigValue } from './get-config-value.js';
|
|
4
|
+
import { getUniqueConfigFiles } from './get-unique-config-files.js';
|
|
5
|
+
export const appendCrossConfigFilesToIgnores = (configBlock) => chain([
|
|
6
|
+
{
|
|
7
|
+
ignores: [TEMPLATES, JSONS],
|
|
8
|
+
key: SOURCES,
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
ignores: [TEMPLATES, JSONS],
|
|
12
|
+
key: TESTS,
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
ignores: [SOURCES, TESTS, JSONS, NX],
|
|
16
|
+
key: TEMPLATES,
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
ignores: [SOURCES, TESTS, TEMPLATES, NX],
|
|
20
|
+
key: JSONS,
|
|
21
|
+
},
|
|
22
|
+
])
|
|
23
|
+
.map(({ ignores, key }) => [
|
|
24
|
+
key,
|
|
25
|
+
(getConfigValue(configBlock, key) ?? []).map((config) => {
|
|
26
|
+
const currentIgnores = config.ignores ?? [];
|
|
27
|
+
const updatedIgnores = [
|
|
28
|
+
...currentIgnores,
|
|
29
|
+
...getUniqueConfigFiles(configBlock, ignores),
|
|
30
|
+
];
|
|
31
|
+
return cloneDeep(isEmpty(updatedIgnores)
|
|
32
|
+
? config
|
|
33
|
+
: { ...config, ignores: updatedIgnores });
|
|
34
|
+
}),
|
|
35
|
+
])
|
|
36
|
+
.reduce((acc, [key, configs]) => ({ ...acc, [key]: configs }), {
|
|
37
|
+
...configBlock,
|
|
38
|
+
})
|
|
39
|
+
.value();
|
|
40
|
+
//# sourceMappingURL=append-cross-config-files-to-ignores.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"append-cross-config-files-to-ignores.js","sourceRoot":"/","sources":["src/builder/append-cross-config-files-to-ignores.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEtD,OAAO,EAGL,KAAK,EACL,EAAE,EACF,OAAO,EACP,SAAS,EACT,KAAK,GACN,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEpE,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAC7C,WAAwB,EACX,EAAE,CACf,KAAK,CAAC;IACJ;QACE,OAAO,EAAE,CAAC,SAAS,EAAE,KAAK,CAAC;QAC3B,GAAG,EAAE,OAAO;KACb;IACD;QACE,OAAO,EAAE,CAAC,SAAS,EAAE,KAAK,CAAC;QAC3B,GAAG,EAAE,KAAK;KACX;IACD;QACE,OAAO,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC;QACpC,GAAG,EAAE,SAAS;KACf;IACD;QACE,OAAO,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,CAAC;QACxC,GAAG,EAAE,KAAK;KACX;CACF,CAAC;KACC,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;IACzB,GAAG;IACH,CAAC,cAAc,CAAC,WAAW,EAAE,GAAgB,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;QACnE,MAAM,cAAc,GAAa,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC;QACtD,MAAM,cAAc,GAAG;YACrB,GAAG,cAAc;YACjB,GAAG,oBAAoB,CAAC,WAAW,EAAE,OAAO,CAAC;SAC9C,CAAC;QAEF,OAAO,SAAS,CACd,OAAO,CAAC,cAAc,CAAC;YACrB,CAAC,CAAC,MAAM;YACR,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,CAC3C,CAAC;IACJ,CAAC,CAAC;CACH,CAAC;KACD,MAAM,CACL,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,GAAG,EAAE,CAAC,GAAgB,CAAC,EAAE,OAAO,EAAE,CAAC,EAClE;IACE,GAAG,WAAW;CACA,CACjB;KACA,KAAK,EAAE,CAAC"}
|
|
@@ -11,6 +11,10 @@ declare class ESLintConfigBuilder {
|
|
|
11
11
|
build(): Linter.Config[];
|
|
12
12
|
reset(): this;
|
|
13
13
|
private addConfigBlock;
|
|
14
|
+
private getOptionalArrayOrThrow;
|
|
15
|
+
private getOptionalStringOrThrow;
|
|
16
|
+
private getOptionalBooleanOrThrow;
|
|
17
|
+
private getOptionalObjectOrThrow;
|
|
14
18
|
}
|
|
15
19
|
export declare const configBuilder: () => ESLintConfigBuilder;
|
|
16
20
|
export {};
|
|
@@ -4,43 +4,37 @@ import { IGNORED, JSONS, NX, SOURCES, TEMPLATES, TESTS, } from '../interfaces.js
|
|
|
4
4
|
import { createJsonConfigBlock } from '../json/index.js';
|
|
5
5
|
import { createNxConfigBlock } from '../nx/index.js';
|
|
6
6
|
import { createTypeScriptConfigBlock, createTypeScriptTestsConfigBlock, } from '../typescript/index.js';
|
|
7
|
-
import {
|
|
7
|
+
import { appendCrossConfigFilesToIgnores } from './append-cross-config-files-to-ignores.js';
|
|
8
8
|
class ESLintConfigBuilder {
|
|
9
9
|
constructor() {
|
|
10
10
|
this.configBlocks = {};
|
|
11
11
|
}
|
|
12
12
|
addTypeScriptConfig(options) {
|
|
13
|
-
|
|
14
|
-
return this.addConfigBlock(createTypeScriptConfigBlock(sources, tsconfigRootDir, shouldResolveAppRootDir));
|
|
13
|
+
return this.addConfigBlock(createTypeScriptConfigBlock(this.getOptionalArrayOrThrow(options, 'sources'), this.getOptionalStringOrThrow(options, 'tsconfigRootDir'), this.getOptionalBooleanOrThrow(options, 'shouldResolveAppRootDir')));
|
|
15
14
|
}
|
|
16
15
|
addTypeScriptTestsConfig(options) {
|
|
17
|
-
|
|
18
|
-
return this.addConfigBlock(createTypeScriptTestsConfigBlock(sources, tsconfigRootDir));
|
|
16
|
+
return this.addConfigBlock(createTypeScriptTestsConfigBlock(this.getOptionalArrayOrThrow(options, 'sources'), this.getOptionalStringOrThrow(options, 'tsconfigRootDir')));
|
|
19
17
|
}
|
|
20
18
|
addAngularConfig(options) {
|
|
21
|
-
|
|
22
|
-
return this.addConfigBlock(createAngularConfigBlock(prefix, sources, tests, templates, jsons, ignored));
|
|
19
|
+
return this.addConfigBlock(createAngularConfigBlock(this.getOptionalStringOrThrow(options, 'prefix'), this.getOptionalArrayOrThrow(options, 'sources'), this.getOptionalArrayOrThrow(options, 'tests'), this.getOptionalArrayOrThrow(options, 'templates'), this.getOptionalArrayOrThrow(options, 'jsons'), this.getOptionalArrayOrThrow(options, 'ignored')));
|
|
23
20
|
}
|
|
24
21
|
addJsonConfig(options) {
|
|
25
|
-
|
|
26
|
-
return this.addConfigBlock(createJsonConfigBlock(jsons));
|
|
22
|
+
return this.addConfigBlock(createJsonConfigBlock(this.getOptionalArrayOrThrow(options, 'jsons')));
|
|
27
23
|
}
|
|
28
24
|
addNxConfig(options) {
|
|
29
|
-
|
|
30
|
-
return this.addConfigBlock(createNxConfigBlock(sources));
|
|
25
|
+
return this.addConfigBlock(createNxConfigBlock(this.getOptionalArrayOrThrow(options, 'sources'), this.getOptionalObjectOrThrow(options, 'rulesConfig')));
|
|
31
26
|
}
|
|
32
27
|
addIgnored(options) {
|
|
33
|
-
const { ignored } = options;
|
|
34
28
|
return this.addConfigBlock({
|
|
35
29
|
[IGNORED]: [
|
|
36
30
|
{
|
|
37
|
-
ignores: ignored,
|
|
31
|
+
ignores: this.getOptionalArrayOrThrow(options, 'ignored'),
|
|
38
32
|
},
|
|
39
33
|
],
|
|
40
34
|
});
|
|
41
35
|
}
|
|
42
36
|
build() {
|
|
43
|
-
this.configBlocks =
|
|
37
|
+
this.configBlocks = appendCrossConfigFilesToIgnores(this.configBlocks);
|
|
44
38
|
return defineConfig([
|
|
45
39
|
...(this.configBlocks[SOURCES] ?? []),
|
|
46
40
|
...(this.configBlocks[TESTS] ?? []),
|
|
@@ -81,6 +75,47 @@ class ESLintConfigBuilder {
|
|
|
81
75
|
];
|
|
82
76
|
return this;
|
|
83
77
|
}
|
|
78
|
+
getOptionalArrayOrThrow(obj, key) {
|
|
79
|
+
if (!obj) {
|
|
80
|
+
throw new Error(`Expected an object`);
|
|
81
|
+
}
|
|
82
|
+
const value = obj[key];
|
|
83
|
+
if (value !== undefined && (value === null || !Array.isArray(value))) {
|
|
84
|
+
throw new Error(`${String(key)} must be an array or undefined`);
|
|
85
|
+
}
|
|
86
|
+
return value;
|
|
87
|
+
}
|
|
88
|
+
getOptionalStringOrThrow(obj, key) {
|
|
89
|
+
if (!obj) {
|
|
90
|
+
throw new Error(`Expected an object`);
|
|
91
|
+
}
|
|
92
|
+
const value = obj[key];
|
|
93
|
+
if (value !== undefined && typeof value !== 'string') {
|
|
94
|
+
throw new Error(`${String(key)} must be a string or undefined`);
|
|
95
|
+
}
|
|
96
|
+
return value;
|
|
97
|
+
}
|
|
98
|
+
getOptionalBooleanOrThrow(obj, key) {
|
|
99
|
+
if (!obj) {
|
|
100
|
+
throw new Error(`Expected an object`);
|
|
101
|
+
}
|
|
102
|
+
const value = obj[key];
|
|
103
|
+
if (value !== undefined && (value === null || typeof value !== 'boolean')) {
|
|
104
|
+
throw new Error(`${String(key)} must be a boolean or undefined`);
|
|
105
|
+
}
|
|
106
|
+
return value;
|
|
107
|
+
}
|
|
108
|
+
getOptionalObjectOrThrow(obj, key) {
|
|
109
|
+
if (!obj) {
|
|
110
|
+
throw new Error(`Expected an object`);
|
|
111
|
+
}
|
|
112
|
+
const value = obj[key];
|
|
113
|
+
if (value !== undefined &&
|
|
114
|
+
(value === null || typeof value !== 'object' || Array.isArray(value))) {
|
|
115
|
+
throw new Error(`${String(key)} must be an object or undefined`);
|
|
116
|
+
}
|
|
117
|
+
return value;
|
|
118
|
+
}
|
|
84
119
|
}
|
|
85
120
|
export const configBuilder = () => new ESLintConfigBuilder();
|
|
86
121
|
//# sourceMappingURL=config-builder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-builder.js","sourceRoot":"/","sources":["src/builder/config-builder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAGL,OAAO,EAGP,KAAK,EACL,EAAE,EAEF,OAAO,EACP,SAAS,EACT,KAAK,GAGN,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EACL,2BAA2B,EAC3B,gCAAgC,GACjC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"config-builder.js","sourceRoot":"/","sources":["src/builder/config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AC,GAAG,CAAC,CAAC;QAEvB,IAAI,KAAK,KAAK,SAAS,IAAI,CAAC,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,SAAS,CAAC,EAAE,CAAC;YAC1E,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;QACnE,CAAC;QAED,OAAO,KAA4B,CAAC;IACtC,CAAC;IAEO,wBAAwB,CAC9B,GAAM,EACN,GAAY;QAEZ,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;QACxC,CAAC;QAED,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;QAEvB,IACE,KAAK,KAAK,SAAS;YACnB,CAAC,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EACrE,CAAC;YACD,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;QACnE,CAAC;QAED,OAAO,KAA4C,CAAC;IACtD,CAAC;CACF;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,GAAwB,EAAE,CACrD,IAAI,mBAAmB,EAAE,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Linter } from 'eslint';
|
|
2
|
-
import type { ConfigBlock
|
|
3
|
-
export declare const getConfigValue: (configBlock: ConfigBlock, key:
|
|
2
|
+
import type { ConfigBlock } from '../interfaces.js';
|
|
3
|
+
export declare const getConfigValue: (configBlock: ConfigBlock, key: symbol) => Linter.Config[];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { cloneDeep } from 'lodash-es';
|
|
2
|
-
|
|
2
|
+
import { isConfigKey } from './is-config-key.js';
|
|
3
|
+
export const getConfigValue = (configBlock, key) => isConfigKey(key) ? cloneDeep(configBlock[key] ?? []) : [];
|
|
3
4
|
//# sourceMappingURL=get-config-value.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-config-value.js","sourceRoot":"/","sources":["src/builder/get-config-value.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"get-config-value.js","sourceRoot":"/","sources":["src/builder/get-config-value.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGtC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,WAAwB,EACxB,GAAW,EACM,EAAE,CACnB,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { uniq } from 'lodash-es';
|
|
2
|
+
import { getConfigValue } from './get-config-value.js';
|
|
3
|
+
import { isConfigKey } from './is-config-key.js';
|
|
4
|
+
export const getUniqueConfigFiles = (configBlock, keys) => uniq([
|
|
5
|
+
...(keys ?? [])
|
|
6
|
+
.flatMap((key) => isConfigKey(key) ? getConfigValue(configBlock, key) : [])
|
|
7
|
+
.flatMap((config) => config?.files ?? [])
|
|
8
|
+
.flat(),
|
|
9
|
+
]);
|
|
10
|
+
//# sourceMappingURL=get-unique-config-files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-unique-config-files.js","sourceRoot":"/","sources":["src/builder/get-unique-config-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,WAAwB,EACxB,IAAc,EACJ,EAAE,CACZ,IAAI,CAAC;IACH,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC;SACZ,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CACf,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,WAAW,EAAE,GAAgB,CAAC,CAAC,CAAC,CAAC,EAAE,CACtE;SACA,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,KAAK,IAAI,EAAE,CAAC;SACxC,IAAI,EAAE;CACV,CAAC,CAAC"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
export { addCrossConfigOffRules } from './add-cross-config-off-rules.js';
|
|
2
1
|
export { appendConfigWhenDefined } from './append-config-when-defined.js';
|
|
2
|
+
export { appendCrossConfigFilesToIgnores } from './append-cross-config-files-to-ignores.js';
|
|
3
3
|
export { configBuilder } from './config-builder.js';
|
|
4
|
-
export { createOffRulesConfig } from './create-off-rules-config.js';
|
|
5
|
-
export { disableAllRules } from './disable-all-rules.js';
|
|
6
|
-
export { findFirstFiles as getFiles } from './find-first-files.js';
|
|
7
4
|
export { getKeys } from './get-keys.js';
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
export { addCrossConfigOffRules } from './add-cross-config-off-rules.js';
|
|
2
1
|
export { appendConfigWhenDefined } from './append-config-when-defined.js';
|
|
2
|
+
export { appendCrossConfigFilesToIgnores } from './append-cross-config-files-to-ignores.js';
|
|
3
3
|
export { configBuilder } from './config-builder.js';
|
|
4
|
-
export { createOffRulesConfig } from './create-off-rules-config.js';
|
|
5
|
-
export { disableAllRules } from './disable-all-rules.js';
|
|
6
|
-
export { findFirstFiles as getFiles } from './find-first-files.js';
|
|
7
4
|
export { getKeys } from './get-keys.js';
|
|
8
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["src/builder/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["src/builder/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,+BAA+B,EAAE,MAAM,2CAA2C,CAAC;AAC5F,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IGNORED, JSONS, NX, SOURCES, TEMPLATES, TESTS, } from '../interfaces.js';
|
|
2
|
+
export const isConfigKey = (value) => typeof value === 'symbol' &&
|
|
3
|
+
(value === SOURCES ||
|
|
4
|
+
value === TESTS ||
|
|
5
|
+
value === TEMPLATES ||
|
|
6
|
+
value === JSONS ||
|
|
7
|
+
value === NX ||
|
|
8
|
+
value === IGNORED);
|
|
9
|
+
//# sourceMappingURL=is-config-key.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-config-key.js","sourceRoot":"/","sources":["src/builder/is-config-key.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,OAAO,EACP,KAAK,EACL,EAAE,EACF,OAAO,EACP,SAAS,EACT,KAAK,GACN,MAAM,kBAAkB,CAAC;AAE1B,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAc,EAAsB,EAAE,CAChE,OAAO,KAAK,KAAK,QAAQ;IACzB,CAAC,KAAK,KAAK,OAAO;QAChB,KAAK,KAAK,KAAK;QACf,KAAK,KAAK,SAAS;QACnB,KAAK,KAAK,KAAK;QACf,KAAK,KAAK,EAAE;QACZ,KAAK,KAAK,OAAO,CAAC,CAAC"}
|
package/dist/src/interfaces.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DepConstraint } from '@nx/eslint-plugin/src/utils/runtime-lint-utils.js';
|
|
1
2
|
import type { Linter } from 'eslint';
|
|
2
3
|
export declare const SOURCES: unique symbol;
|
|
3
4
|
export declare const TESTS: unique symbol;
|
|
@@ -5,7 +6,7 @@ export declare const TEMPLATES: unique symbol;
|
|
|
5
6
|
export declare const JSONS: unique symbol;
|
|
6
7
|
export declare const NX: unique symbol;
|
|
7
8
|
export declare const IGNORED: unique symbol;
|
|
8
|
-
export type ConfigKey = typeof SOURCES | typeof TESTS | typeof TEMPLATES | typeof JSONS | typeof NX;
|
|
9
|
+
export type ConfigKey = typeof SOURCES | typeof TESTS | typeof TEMPLATES | typeof JSONS | typeof NX | typeof IGNORED;
|
|
9
10
|
export interface ConfigBlock {
|
|
10
11
|
[SOURCES]?: Linter.Config[];
|
|
11
12
|
[TESTS]?: Linter.Config[];
|
|
@@ -36,7 +37,44 @@ export interface JsonConfigOptions {
|
|
|
36
37
|
}
|
|
37
38
|
export interface NxConfigOptions {
|
|
38
39
|
sources?: string[];
|
|
40
|
+
rulesConfig?: NxConfigRulesConfig;
|
|
41
|
+
}
|
|
42
|
+
export interface NxConfigRulesConfig {
|
|
43
|
+
dependencyChecks?: DependencyChecksRuleConfig;
|
|
44
|
+
enforceModuleBoundaries?: EnforceModuleBoundariesRuleConfig;
|
|
45
|
+
nxPluginChecks?: NxPluginChecksRuleConfig;
|
|
39
46
|
}
|
|
40
47
|
export interface IgnoredOptions {
|
|
41
48
|
ignored?: string[];
|
|
42
49
|
}
|
|
50
|
+
export interface EnforceModuleBoundariesRuleConfig {
|
|
51
|
+
allow: string[];
|
|
52
|
+
buildTargets: string[];
|
|
53
|
+
depConstraints: DepConstraint[];
|
|
54
|
+
enforceBuildableLibDependency: boolean;
|
|
55
|
+
allowCircularSelfDependency: boolean;
|
|
56
|
+
ignoredCircularDependencies: [string, string][];
|
|
57
|
+
checkDynamicDependenciesExceptions: string[];
|
|
58
|
+
banTransitiveDependencies: boolean;
|
|
59
|
+
checkNestedExternalImports: boolean;
|
|
60
|
+
}
|
|
61
|
+
export interface DependencyChecksRuleConfig {
|
|
62
|
+
buildTargets?: string[];
|
|
63
|
+
checkMissingDependencies?: boolean;
|
|
64
|
+
checkObsoleteDependencies?: boolean;
|
|
65
|
+
checkVersionMismatches?: boolean;
|
|
66
|
+
ignoredDependencies?: string[];
|
|
67
|
+
ignoredFiles?: string[];
|
|
68
|
+
includeTransitiveDependencies?: boolean;
|
|
69
|
+
useLocalPathsForWorkspaceDependencies?: boolean;
|
|
70
|
+
peerDepsVersionStrategy?: 'installed' | 'workspace';
|
|
71
|
+
runtimeHelpers?: string[];
|
|
72
|
+
}
|
|
73
|
+
export interface NxPluginChecksRuleConfig {
|
|
74
|
+
generatorsJson?: string;
|
|
75
|
+
executorsJson?: string;
|
|
76
|
+
migrationsJson?: string;
|
|
77
|
+
packageJson?: string;
|
|
78
|
+
allowedVersionStrings?: string[];
|
|
79
|
+
tsConfig?: string;
|
|
80
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"/","sources":["src/interfaces.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"/","sources":["src/interfaces.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;AACzC,MAAM,CAAC,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;AACrC,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;AAC7C,MAAM,CAAC,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;AACrC,MAAM,CAAC,MAAM,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;AAC/B,MAAM,CAAC,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC"}
|
package/dist/src/json/jsonc.js
CHANGED
|
@@ -1,26 +1,66 @@
|
|
|
1
1
|
import json from '@eslint/json';
|
|
2
2
|
import jsonc from 'eslint-plugin-jsonc';
|
|
3
|
-
import jsoncParser from 'jsonc-eslint-parser';
|
|
4
|
-
import {
|
|
5
|
-
export const getJsoncConfigs = (jsons) =>
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
},
|
|
13
|
-
plugins: {
|
|
14
|
-
json,
|
|
15
|
-
jsonc,
|
|
16
|
-
},
|
|
17
|
-
rules: {
|
|
18
|
-
...jsonc.configs['flat/recommended-with-jsonc'].rules,
|
|
19
|
-
'jsonc/no-comments': 'error',
|
|
20
|
-
'jsonc/no-dupe-keys': 'error',
|
|
21
|
-
'jsonc/sort-keys': 'error',
|
|
22
|
-
'jsonc/valid-json-number': 'error',
|
|
23
|
-
},
|
|
3
|
+
import * as jsoncParser from 'jsonc-eslint-parser';
|
|
4
|
+
import { match } from 'ts-pattern';
|
|
5
|
+
export const getJsoncConfigs = (jsons) => match(jsons?.length ?? 0)
|
|
6
|
+
.with(0, () => [])
|
|
7
|
+
.otherwise(() => [
|
|
8
|
+
{
|
|
9
|
+
files: jsons,
|
|
10
|
+
languageOptions: {
|
|
11
|
+
parser: jsoncParser,
|
|
24
12
|
},
|
|
25
|
-
|
|
13
|
+
plugins: {
|
|
14
|
+
json,
|
|
15
|
+
jsonc,
|
|
16
|
+
},
|
|
17
|
+
rules: {
|
|
18
|
+
...jsonc.configs['flat/recommended-with-jsonc'].rules,
|
|
19
|
+
'jsonc/array-bracket-newline': 'off',
|
|
20
|
+
'jsonc/array-bracket-spacing': 'off',
|
|
21
|
+
'jsonc/array-element-newline': 'off',
|
|
22
|
+
'jsonc/auto': 'off',
|
|
23
|
+
'jsonc/comma-dangle': 'off',
|
|
24
|
+
'jsonc/comma-style': 'off',
|
|
25
|
+
'jsonc/indent': 'off',
|
|
26
|
+
'jsonc/key-name-casing': 'off',
|
|
27
|
+
'jsonc/key-spacing': 'off',
|
|
28
|
+
'jsonc/no-bigint-literals': 'off',
|
|
29
|
+
'jsonc/no-binary-expression': 'off',
|
|
30
|
+
'jsonc/no-binary-numeric-literals': 'off',
|
|
31
|
+
'jsonc/no-comments': 'error',
|
|
32
|
+
'jsonc/no-dupe-keys': 'error',
|
|
33
|
+
'jsonc/no-escape-sequence-in-identifier': 'off',
|
|
34
|
+
'jsonc/no-floating-decimal': 'off',
|
|
35
|
+
'jsonc/no-hexadecimal-numeric-literals': 'off',
|
|
36
|
+
'jsonc/no-infinity': 'off',
|
|
37
|
+
'jsonc/no-irregular-whitespace': 'off',
|
|
38
|
+
'jsonc/no-multi-str': 'off',
|
|
39
|
+
'jsonc/no-nan': 'off',
|
|
40
|
+
'jsonc/no-number-props': 'off',
|
|
41
|
+
'jsonc/no-numeric-separators': 'off',
|
|
42
|
+
'jsonc/no-octal': 'off',
|
|
43
|
+
'jsonc/no-octal-escape': 'off',
|
|
44
|
+
'jsonc/no-octal-numeric-literals': 'off',
|
|
45
|
+
'jsonc/no-parenthesized': 'off',
|
|
46
|
+
'jsonc/no-plus-sign': 'off',
|
|
47
|
+
'jsonc/no-regexp-literals': 'off',
|
|
48
|
+
'jsonc/no-sparse-arrays': 'off',
|
|
49
|
+
'jsonc/no-template-literals': 'off',
|
|
50
|
+
'jsonc/no-undefined-value': 'off',
|
|
51
|
+
'jsonc/no-unicode-codepoint-escapes': 'off',
|
|
52
|
+
'jsonc/no-useless-escape': 'off',
|
|
53
|
+
'jsonc/object-curly-newline': 'off',
|
|
54
|
+
'jsonc/object-curly-spacing': 'off',
|
|
55
|
+
'jsonc/object-property-newline': 'off',
|
|
56
|
+
'jsonc/quote-props': 'off',
|
|
57
|
+
'jsonc/quotes': 'off',
|
|
58
|
+
'jsonc/sort-array-values': 'off',
|
|
59
|
+
'jsonc/sort-keys': 'error',
|
|
60
|
+
'jsonc/space-unary-ops': 'off',
|
|
61
|
+
'jsonc/valid-json-number': 'error',
|
|
62
|
+
'jsonc/vue-custom-block/no-parsing-error': 'off',
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
]);
|
|
26
66
|
//# sourceMappingURL=jsonc.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsonc.js","sourceRoot":"/","sources":["src/json/jsonc.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,cAAc,CAAC;AAEhC,OAAO,KAAK,MAAM,qBAAqB,CAAC;AACxC,OAAO,WAAW,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"jsonc.js","sourceRoot":"/","sources":["src/json/jsonc.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,cAAc,CAAC;AAEhC,OAAO,KAAK,MAAM,qBAAqB,CAAC;AACxC,OAAO,KAAK,WAAW,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAgB,EAAmB,EAAE,CACnE,KAAK,CAAC,KAAK,EAAE,MAAM,IAAI,CAAC,CAAC;KACtB,IAAI,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;KACjB,SAAS,CAAC,GAAG,EAAE,CAAC;IACf;QACE,KAAK,EAAE,KAAK;QACZ,eAAe,EAAE;YACf,MAAM,EAAE,WAAW;SACpB;QACD,OAAO,EAAE;YACP,IAAI;YACJ,KAAK;SACiC;QACxC,KAAK,EAAE;YAEL,GAAI,KAAK,CAAC,OAAO,CAAC,6BAA6B,CAAS,CAAC,KAAK;YAC9D,6BAA6B,EAAE,KAAK;YACpC,6BAA6B,EAAE,KAAK;YACpC,6BAA6B,EAAE,KAAK;YACpC,YAAY,EAAE,KAAK;YACnB,oBAAoB,EAAE,KAAK;YAC3B,mBAAmB,EAAE,KAAK;YAC1B,cAAc,EAAE,KAAK;YACrB,uBAAuB,EAAE,KAAK;YAC9B,mBAAmB,EAAE,KAAK;YAC1B,0BAA0B,EAAE,KAAK;YACjC,4BAA4B,EAAE,KAAK;YACnC,k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