eslint-config-un 1.0.0-alpha.19 → 1.0.0-alpha.20
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 +1 -0
- package/dist/angular-cWftUPrZ.js +102 -0
- package/dist/astro-CvR9K0gV.js +51 -0
- package/dist/ava-SLDP66eK.js +23 -0
- package/dist/better-tailwind-azPYeaEn.js +22 -0
- package/dist/case-police-DBwLQOVl.js +22 -0
- package/dist/cli-BzQFfgVw.js +26 -0
- package/dist/cloudfront-functions-BVhErVDp.js +155 -0
- package/dist/compat-B93yCNFB.js +17 -0
- package/dist/cspell-Bm6iyjh-.js +23 -0
- package/dist/css-DTwag5G6.js +36 -0
- package/dist/css-in-js-DycfdUwQ.js +22 -0
- package/dist/cypress-9Xn3n9ew.js +23 -0
- package/dist/de-morgan-Cz-bumEx.js +19 -0
- package/dist/depend-Ui3Jv1M-.js +22 -0
- package/dist/ember-BdN_N0Pf.js +40 -0
- package/dist/erasable-syntax-only-BTwpy-N9.js +20 -0
- package/dist/es-Bdl9Y-AD.js +4 -0
- package/dist/es-CvoaEvOg.js +51 -0
- package/dist/eslint-CA-T1mGF.js +820 -0
- package/dist/eslint-comments-DSK3-cG0.js +21 -0
- package/dist/eslint-plugin-DOzBdVRJ.js +25 -0
- package/dist/file-progress-BdKBYflw.js +17 -0
- package/dist/graphql-ny5sliuQ.js +103 -0
- package/dist/{html-YP3CKETM.js → html-hhlV3C4E.js} +23 -43
- package/dist/import-Dii1B5QQ.js +60 -0
- package/dist/index.d.ts +31484 -35260
- package/dist/index.js +506 -664
- package/dist/jest-CNiSTRCJ.js +61 -0
- package/dist/js-DccveTXD.js +86 -0
- package/dist/js-inline-Uj2v6w_c.js +60 -0
- package/dist/jsdoc-C3vt6uPV.js +36 -0
- package/dist/json-schema-validator-j937NQr1.js +28 -0
- package/dist/jsonc-DW59DXwo.js +48 -0
- package/dist/jsx-a11y-V0-wCeTY.js +204 -0
- package/dist/lit-CmcOg2hP.js +30 -0
- package/dist/markdown-Cysb9zfR.js +74 -0
- package/dist/math-CTy57jGy.js +17 -0
- package/dist/mdx-CbN8DxRF.js +61 -0
- package/dist/mocha-B7F8FRRw.js +30 -0
- package/dist/nextjs-BpQlzj5U.js +20 -0
- package/dist/no-only-tests-DNt2xV5N.js +20 -0
- package/dist/no-stylistic-rules-B7ZIDLFp.js +4073 -0
- package/dist/no-unsanitized-n86JZvL7.js +16 -0
- package/dist/node-Dy2Mgs0k.js +24 -0
- package/dist/node-dependencies-B0HdPYFH.js +25 -0
- package/dist/package-json-DI9Q5h6H.js +4 -0
- package/dist/package-json-DiWZz25w.js +60 -0
- package/dist/perfectionist-DlbX4_pk.js +67 -0
- package/dist/playwright-19BGSIHO.js +23 -0
- package/dist/pnpm-BItaSLlf.js +35 -0
- package/dist/prefer-arrow-functions-DoXDp5_p.js +19 -0
- package/dist/promise-uLyVQGSa.js +22 -0
- package/dist/qunit-CGut-G_3.js +23 -0
- package/dist/qwik-CSE-ydoQ.js +23 -0
- package/dist/react-DwOfoJ5v.js +238 -0
- package/dist/regexp-C5Mt8Vt1.js +19 -0
- package/dist/security-K1j49Qbg.js +19 -0
- package/dist/shared-CjK2SSQm.js +163 -0
- package/dist/solid-DFFYo2kB.js +24 -0
- package/dist/sonar-i6RwbYTO.js +28 -0
- package/dist/storybook-Dnevld2C.js +20 -0
- package/dist/svelte-IexC5os1.js +71 -0
- package/dist/tailwind-DGPH66UZ.js +40 -0
- package/dist/tanstack-query-C5mBd_2E.js +16 -0
- package/dist/testing-library-B-Lni31b.js +49 -0
- package/dist/toml-CNAA7_2c.js +30 -0
- package/dist/ts-ByImKELq.js +451 -0
- package/dist/turbo-D20dzRT0.js +17 -0
- package/dist/unicorn-V52iQY8k.js +25 -0
- package/dist/unused-imports-C-W5w88w.js +21 -0
- package/dist/vitest-DvFjyQsm.js +40 -0
- package/dist/vue-VVN9O93f.js +161 -0
- package/dist/web-components-BUdAzFGR.js +17 -0
- package/dist/yaml-DRDyOsl2.js +29 -0
- package/dist/you-dont-need-lodash-underscore-DsPbh8fD.js +98 -0
- package/package.json +9 -4
- package/dist/angular-YCMZSUBR.js +0 -314
- package/dist/astro-USB7EQPO.js +0 -81
- package/dist/ava-2WE465FC.js +0 -54
- package/dist/better-tailwind-3LM4EYQQ.js +0 -61
- package/dist/case-police-NOCXLAUN.js +0 -29
- package/dist/chunk-34U5NLR4.js +0 -96
- package/dist/chunk-7GRRU4PU.js +0 -1352
- package/dist/chunk-7NLUWIPQ.js +0 -291
- package/dist/chunk-QH3CXGTX.js +0 -137
- package/dist/cli-7X4BSWJY.js +0 -37
- package/dist/cloudfront-functions-L7RXJUXL.js +0 -195
- package/dist/compat-7Z4HGBJO.js +0 -25
- package/dist/cspell-ZJVBJY52.js +0 -30
- package/dist/css-HRLA4CL4.js +0 -57
- package/dist/css-in-js-76ZEPUBW.js +0 -45
- package/dist/cypress-R24VFPUT.js +0 -47
- package/dist/de-morgan-6W64X5BH.js +0 -20
- package/dist/depend-VENGPMOB.js +0 -39
- package/dist/ember-EGDXPR45.js +0 -67
- package/dist/erasable-syntax-only-5USINYBA.js +0 -29
- package/dist/es-ANORRNHP.js +0 -7
- package/dist/eslint-comments-4VRQELVF.js +0 -37
- package/dist/eslint-plugin-X3KNR2Y6.js +0 -54
- package/dist/file-progress-SEBSKC3Z.js +0 -29
- package/dist/graphql-242LDQKM.js +0 -153
- package/dist/import-VZVFIGD6.js +0 -78
- package/dist/jest-JLVTPK5H.js +0 -150
- package/dist/js-HGHBG5WC.js +0 -87
- package/dist/js-inline-MHCUA4LN.js +0 -91
- package/dist/jsdoc-SXCZO6YP.js +0 -70
- package/dist/json-schema-validator-SL3OFJPZ.js +0 -64
- package/dist/jsonc-D3PPQB7R.js +0 -55
- package/dist/jsx-a11y-MJR2L2J2.js +0 -264
- package/dist/lit-GVIY5QFO.js +0 -50
- package/dist/markdown-LC4CZA7Q.js +0 -167
- package/dist/math-PTTJZ7SK.js +0 -28
- package/dist/mdx-VHHKRW3B.js +0 -127
- package/dist/mocha-NBNKBFSN.js +0 -69
- package/dist/nextjs-XJH5ZVRH.js +0 -38
- package/dist/no-only-tests-XOYQJWLM.js +0 -30
- package/dist/no-stylistic-rules-GABBHFPQ.js +0 -7552
- package/dist/no-unsanitized-OGWYOATL.js +0 -20
- package/dist/node-7CTPMPVL.js +0 -60
- package/dist/node-dependencies-CUKC32FZ.js +0 -49
- package/dist/package-json-YBQP2LMG.js +0 -9
- package/dist/perfectionist-L3RWKIRE.js +0 -115
- package/dist/playwright-TPAZDIXF.js +0 -67
- package/dist/pnpm-R46OJPAM.js +0 -53
- package/dist/prefer-arrow-functions-PAXOQPVI.js +0 -26
- package/dist/promise-NOSKOFGV.js +0 -22
- package/dist/qunit-QQGQH32N.js +0 -54
- package/dist/qwik-LPX5C6YC.js +0 -37
- package/dist/react-ER2LWC6K.js +0 -538
- package/dist/regexp-YSTIEWPA.js +0 -22
- package/dist/security-6RL4NLI7.js +0 -22
- package/dist/solid-7QKWJPIJ.js +0 -43
- package/dist/sonar-7LDOT2YA.js +0 -35
- package/dist/storybook-JMBKGYZB.js +0 -36
- package/dist/svelte-5ARXC4EV.js +0 -121
- package/dist/tailwind-6R56UFAJ.js +0 -50
- package/dist/tanstack-query-DEMDV23E.js +0 -20
- package/dist/testing-library-KZXEXNWC.js +0 -119
- package/dist/toml-PHKO7GS7.js +0 -49
- package/dist/ts-UCT2BC5A.js +0 -703
- package/dist/turbo-FDDLGWOI.js +0 -25
- package/dist/unicorn-FO5MAYSE.js +0 -27
- package/dist/unused-imports-HDTO5QS3.js +0 -35
- package/dist/vitest-XNTUJCDA.js +0 -102
- package/dist/vue-O6WXAMCF.js +0 -377
- package/dist/yaml-6TDWDDUY.js +0 -62
- package/dist/you-dont-need-lodash-underscore-PNLNS64I.js +0 -113
package/README.md
CHANGED
|
@@ -310,6 +310,7 @@ Sub-config is a Config located within Config's options. If the parent config is
|
|
|
310
310
|
|  `eslintPlugin` | ❌ | [eslint-plugin-eslint-plugin](https://npmjs.com/eslint-plugin-eslint-plugin) (`eslint-plugin`) | Since v1.0.0<br>For linting ESLint plugins |
|
|
311
311
|
| `fileProgress` | ❌ | [eslint-plugin-file-progress](https://npmjs.com/eslint-plugin-file-progress) (`file-progress`) | Since v1.0.0<br>An ESlint plugin to print file progress |
|
|
312
312
|
| `compat` | ❌ | [eslint-plugin-compat](https://npmjs.com/eslint-plugin-compat) (`compat`) | Since v1.0.0 |
|
|
313
|
+
| `webComponents` | ❌ | [eslint-plugin-wc](https://npmjs.com/eslint-plugin-wc) (`wc`) | Since v1.0.0 |
|
|
313
314
|
|
|
314
315
|
## How to use
|
|
315
316
|
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { ERROR, GLOB_HTML, GLOB_JS_TS_X, OFF, WARNING, assignDefaults, cloneDeep, createConfigBuilder, fetchPackageInfo, interopDefault, pluginsLoaders } from "./eslint-CA-T1mGF.js";
|
|
2
|
+
|
|
3
|
+
//#region src/configs/angular.ts
|
|
4
|
+
const SUPPORTED_ANGULAR_VERSIONS = [
|
|
5
|
+
13,
|
|
6
|
+
14,
|
|
7
|
+
15,
|
|
8
|
+
16,
|
|
9
|
+
17,
|
|
10
|
+
18,
|
|
11
|
+
19,
|
|
12
|
+
20
|
|
13
|
+
];
|
|
14
|
+
const LATEST_SUPPORTED_ANGULAR_VERSION = SUPPORTED_ANGULAR_VERSIONS.at(-1);
|
|
15
|
+
const angularUnConfig = async (context) => {
|
|
16
|
+
const optionsRaw = context.rootOptions.configs?.angular;
|
|
17
|
+
const optionsResolved = assignDefaults(optionsRaw, {
|
|
18
|
+
configTemplate: true,
|
|
19
|
+
processInlineTemplates: true,
|
|
20
|
+
componentClassSuffixes: ["Component"],
|
|
21
|
+
componentSelector: true,
|
|
22
|
+
componentStylesStyle: true,
|
|
23
|
+
directiveClassSuffixes: ["Directive"],
|
|
24
|
+
directiveSelector: true,
|
|
25
|
+
disallowedInputPrefixes: ["on"],
|
|
26
|
+
disallowAttributeDecorator: false,
|
|
27
|
+
disallowForwardRef: false
|
|
28
|
+
});
|
|
29
|
+
const angularVersion = optionsResolved.angularVersion ?? (() => {
|
|
30
|
+
const majorVersion = context.packagesInfo["@angular/core"]?.versions.major;
|
|
31
|
+
if (majorVersion != null && majorVersion >= SUPPORTED_ANGULAR_VERSIONS[0] && majorVersion <= LATEST_SUPPORTED_ANGULAR_VERSION) return majorVersion;
|
|
32
|
+
return optionsRaw === true ? LATEST_SUPPORTED_ANGULAR_VERSION : null;
|
|
33
|
+
})();
|
|
34
|
+
if (angularVersion == null) return null;
|
|
35
|
+
const { configTemplate, processInlineTemplates, componentClassSuffixes, componentSelector, componentStylesStyle, directiveClassSuffixes, directiveSelector, disallowedInputPrefixes, disallowAttributeDecorator, disallowForwardRef, pipePrefixes } = optionsResolved;
|
|
36
|
+
optionsResolved.preferStandaloneComponents ??= angularVersion >= 19;
|
|
37
|
+
const { preferStandaloneComponents } = optionsResolved;
|
|
38
|
+
const forbiddenMetadataProperties = {
|
|
39
|
+
inputs: true,
|
|
40
|
+
outputs: true,
|
|
41
|
+
queries: true,
|
|
42
|
+
...optionsResolved.forbiddenMetadataProperties
|
|
43
|
+
};
|
|
44
|
+
const configBuilderGeneral = createConfigBuilder(context, optionsResolved, "@angular-eslint");
|
|
45
|
+
const [angularEslintPlugin, angularEslintPluginPackageInfo, angularTemplateEslintPlugin, angularTemplateEslintPluginPackageInfo, angularTemplateParserPackageInfo, extractInlineHtmlProcessor] = await Promise.all([
|
|
46
|
+
pluginsLoaders["@angular-eslint"](context).then(({ module }) => module),
|
|
47
|
+
fetchPackageInfo("@angular-eslint/eslint-plugin"),
|
|
48
|
+
pluginsLoaders["@angular-eslint/template"](context).then(({ module }) => module),
|
|
49
|
+
fetchPackageInfo("@angular-eslint/eslint-plugin-template"),
|
|
50
|
+
fetchPackageInfo("@angular-eslint/template-parser"),
|
|
51
|
+
interopDefault(import("@angular-eslint/eslint-plugin-template")).then((m) => m.processors["extract-inline-html"]).then((processor) => {
|
|
52
|
+
const fixedProcessor = cloneDeep(processor);
|
|
53
|
+
fixedProcessor.meta ||= { name: "extract-inline-html" };
|
|
54
|
+
return fixedProcessor;
|
|
55
|
+
})
|
|
56
|
+
]);
|
|
57
|
+
[
|
|
58
|
+
[angularEslintPluginPackageInfo, "@angular-eslint/eslint-plugin"],
|
|
59
|
+
[angularTemplateEslintPluginPackageInfo, "@angular-eslint/eslint-plugin-template"],
|
|
60
|
+
[angularTemplateParserPackageInfo, "@angular-eslint/template-parser"]
|
|
61
|
+
].forEach(([packageInfo, packageName]) => {
|
|
62
|
+
if (packageInfo?.versions.major != null && packageInfo.versions.major !== angularVersion) context.logger.warn(`Your \`${packageName}\` major version (${packageInfo.versions.major}) might not be compatible with the configured (or detected) Angular major version (${angularVersion}).`);
|
|
63
|
+
});
|
|
64
|
+
const angularEslintPluginRules = Object.keys(angularEslintPlugin?.rules || {});
|
|
65
|
+
const getAngularEslintPluginRuleSeverity = (ruleName, severity) => [ruleName, angularEslintPlugin && !angularEslintPluginRules.includes(ruleName) ? OFF : severity];
|
|
66
|
+
configBuilderGeneral?.addConfig(["angular/general", {
|
|
67
|
+
includeDefaultFilesAndIgnores: true,
|
|
68
|
+
filesFallback: [GLOB_JS_TS_X]
|
|
69
|
+
}], { ...processInlineTemplates && { processor: extractInlineHtmlProcessor } }).addRule(...getAngularEslintPluginRuleSeverity("component-class-suffix", componentClassSuffixes.length === 0 ? OFF : ERROR), [{ ...componentClassSuffixes.length > 0 && { suffixes: componentClassSuffixes } }]).addRule(...getAngularEslintPluginRuleSeverity("component-max-inline-declarations", OFF)).addRule(...getAngularEslintPluginRuleSeverity("component-selector", componentSelector === false ? OFF : ERROR), [{
|
|
70
|
+
type: ["element"],
|
|
71
|
+
style: "kebab-case",
|
|
72
|
+
...typeof componentSelector === "object" && componentSelector
|
|
73
|
+
}]).addRule(...getAngularEslintPluginRuleSeverity("consistent-component-styles", componentStylesStyle === false ? OFF : ERROR), [typeof componentStylesStyle === "string" ? componentStylesStyle : "string"]).addRule(...getAngularEslintPluginRuleSeverity("contextual-decorator", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("contextual-lifecycle", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("directive-class-suffix", directiveClassSuffixes.length === 0 ? OFF : ERROR), [{ ...directiveClassSuffixes.length > 0 && { suffixes: directiveClassSuffixes } }]).addRule(...getAngularEslintPluginRuleSeverity("directive-selector", directiveSelector === false ? OFF : ERROR), [{
|
|
74
|
+
type: ["attribute"],
|
|
75
|
+
style: "camelCase",
|
|
76
|
+
...typeof directiveSelector === "object" && directiveSelector
|
|
77
|
+
}]).addRule(...getAngularEslintPluginRuleSeverity("no-async-lifecycle-method", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("no-attribute-decorator", disallowAttributeDecorator ? ERROR : OFF)).addRule(...getAngularEslintPluginRuleSeverity("no-conflicting-lifecycle", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("no-developer-preview", WARNING)).addRule(...getAngularEslintPluginRuleSeverity("no-duplicates-in-metadata-arrays", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("no-empty-lifecycle-method", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("no-experimental", WARNING)).addRule(...getAngularEslintPluginRuleSeverity("no-forward-ref", disallowForwardRef ? ERROR : OFF)).addRule(...getAngularEslintPluginRuleSeverity("no-host-metadata-property", forbiddenMetadataProperties.host ? ERROR : OFF)).addRule(...getAngularEslintPluginRuleSeverity("prefer-output-emitter-ref", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("no-input-prefix", ERROR), [{ prefixes: disallowedInputPrefixes }]).addRule(...getAngularEslintPluginRuleSeverity("no-input-rename", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("no-inputs-metadata-property", forbiddenMetadataProperties.inputs ? ERROR : OFF)).addRule(...getAngularEslintPluginRuleSeverity("no-lifecycle-call", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("no-output-native", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("no-output-on-prefix", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("no-output-rename", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("no-outputs-metadata-property", forbiddenMetadataProperties.outputs ? ERROR : OFF)).addRule(...getAngularEslintPluginRuleSeverity("no-pipe-impure", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("no-queries-metadata-property", forbiddenMetadataProperties.queries ? ERROR : OFF)).addRule(...getAngularEslintPluginRuleSeverity("no-uncalled-signals", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("pipe-prefix", ERROR), [{ prefixes: pipePrefixes }]).addRule(...getAngularEslintPluginRuleSeverity("prefer-inject", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("prefer-on-push-component-change-detection", OFF)).addRule(...getAngularEslintPluginRuleSeverity("prefer-output-readonly", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("prefer-signals", OFF)).addRule(...getAngularEslintPluginRuleSeverity("prefer-standalone", preferStandaloneComponents && angularVersion >= 17 ? ERROR : OFF)).addRule(...getAngularEslintPluginRuleSeverity("prefer-standalone-component", preferStandaloneComponents && angularVersion < 17 ? ERROR : OFF)).addRule(...getAngularEslintPluginRuleSeverity("relative-url-prefix", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("require-lifecycle-on-prototype", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("require-localize-metadata", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("runtime-localize", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("sort-keys-in-type-decorator", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("sort-lifecycle-methods", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("sort-ngmodule-metadata-arrays", OFF)).addRule(...getAngularEslintPluginRuleSeverity("use-component-selector", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("use-component-view-encapsulation", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("use-injectable-provided-in", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("use-lifecycle-interface", ERROR)).addRule(...getAngularEslintPluginRuleSeverity("use-pipe-transform-interface", ERROR)).addOverrides();
|
|
78
|
+
const angularTemplateEslintPluginRules = Object.keys(angularTemplateEslintPlugin?.rules || {});
|
|
79
|
+
const getAngularEslintTemplatePluginRuleSeverity = (ruleName, severity) => [ruleName, angularTemplateEslintPlugin && !angularTemplateEslintPluginRules.includes(ruleName) ? OFF : severity];
|
|
80
|
+
const configTemplateOptions = assignDefaults(configTemplate, {
|
|
81
|
+
a11yRules: true,
|
|
82
|
+
preferControlFlow: angularVersion >= 19,
|
|
83
|
+
preferNgSrc: false,
|
|
84
|
+
requireLoopIndexes: false
|
|
85
|
+
});
|
|
86
|
+
const { a11yRules, preferControlFlow, preferNgSrc, requireLoopIndexes } = configTemplateOptions;
|
|
87
|
+
const a11yRulesSeverity = a11yRules === true ? ERROR : a11yRules === "warn" ? WARNING : OFF;
|
|
88
|
+
const configBuilderTemplate = createConfigBuilder(context, configTemplate, "@angular-eslint/template");
|
|
89
|
+
configBuilderTemplate?.addConfig(["angular/template", {
|
|
90
|
+
includeDefaultFilesAndIgnores: true,
|
|
91
|
+
filesFallback: [GLOB_HTML],
|
|
92
|
+
parser: "@angular-eslint/template-parser",
|
|
93
|
+
doNotIgnoreHtml: true
|
|
94
|
+
}]).addRule(...getAngularEslintTemplatePluginRuleSeverity("accessibility-alt-text", a11yRulesSeverity)).addRule(...getAngularEslintTemplatePluginRuleSeverity("accessibility-elements-content", a11yRulesSeverity)).addRule(...getAngularEslintTemplatePluginRuleSeverity("accessibility-interactive-supports-focus", a11yRulesSeverity)).addRule(...getAngularEslintTemplatePluginRuleSeverity("accessibility-label-for", a11yRulesSeverity)).addRule(...getAngularEslintTemplatePluginRuleSeverity("accessibility-label-has-associated-control", a11yRulesSeverity)).addRule(...getAngularEslintTemplatePluginRuleSeverity("accessibility-role-has-required-aria", a11yRulesSeverity)).addRule(...getAngularEslintTemplatePluginRuleSeverity("accessibility-table-scope", a11yRulesSeverity)).addRule(...getAngularEslintTemplatePluginRuleSeverity("accessibility-valid-aria", a11yRulesSeverity)).addRule(...getAngularEslintTemplatePluginRuleSeverity("alt-text", a11yRulesSeverity)).addRule(...getAngularEslintTemplatePluginRuleSeverity("attributes-order", ERROR)).addRule(...getAngularEslintTemplatePluginRuleSeverity("banana-in-box", ERROR)).addRule(...getAngularEslintTemplatePluginRuleSeverity("button-has-type", ERROR)).addRule(...getAngularEslintTemplatePluginRuleSeverity("click-events-have-key-events", a11yRulesSeverity)).addRule(...getAngularEslintTemplatePluginRuleSeverity("conditional-complexity", OFF)).addRule(...getAngularEslintTemplatePluginRuleSeverity("cyclomatic-complexity", OFF)).addRule(...getAngularEslintTemplatePluginRuleSeverity("elements-content", a11yRulesSeverity)).addRule(...getAngularEslintTemplatePluginRuleSeverity("eqeqeq", ERROR), [{ allowNullOrUndefined: true }]).addRule(...getAngularEslintTemplatePluginRuleSeverity("i18n", OFF)).addRule(...getAngularEslintTemplatePluginRuleSeverity("interactive-supports-focus", a11yRulesSeverity)).addRule(...getAngularEslintTemplatePluginRuleSeverity("label-has-associated-control", a11yRulesSeverity)).addRule(...getAngularEslintTemplatePluginRuleSeverity("mouse-events-have-key-events", a11yRulesSeverity)).addRule(...getAngularEslintTemplatePluginRuleSeverity("no-any", WARNING)).addRule(...getAngularEslintTemplatePluginRuleSeverity("no-autofocus", a11yRulesSeverity)).addRule(...getAngularEslintTemplatePluginRuleSeverity("no-call-expression", OFF)).addRule(...getAngularEslintTemplatePluginRuleSeverity("no-distracting-elements", a11yRulesSeverity)).addRule(...getAngularEslintTemplatePluginRuleSeverity("no-duplicate-attributes", ERROR)).addRule(...getAngularEslintTemplatePluginRuleSeverity("no-inline-styles", OFF)).addRule(...getAngularEslintTemplatePluginRuleSeverity("no-interpolation-in-attributes", ERROR)).addRule(...getAngularEslintTemplatePluginRuleSeverity("no-negated-async", ERROR)).addRule(...getAngularEslintTemplatePluginRuleSeverity("no-nested-tags", ERROR)).addRule(...getAngularEslintTemplatePluginRuleSeverity("no-positive-tabindex", ERROR)).addRule(...getAngularEslintTemplatePluginRuleSeverity("prefer-at-empty", ERROR)).addRule(...getAngularEslintTemplatePluginRuleSeverity("prefer-contextual-for-variables", ERROR)).addRule(...getAngularEslintTemplatePluginRuleSeverity("prefer-control-flow", preferControlFlow ? ERROR : OFF)).addRule(...getAngularEslintTemplatePluginRuleSeverity("prefer-ngsrc", preferNgSrc ? ERROR : OFF)).addRule(...getAngularEslintTemplatePluginRuleSeverity("prefer-template-literal", ERROR)).addRule(...getAngularEslintTemplatePluginRuleSeverity("prefer-self-closing-tags", OFF)).addRule(...getAngularEslintTemplatePluginRuleSeverity("prefer-static-string-properties", ERROR)).addRule(...getAngularEslintTemplatePluginRuleSeverity("role-has-required-aria", a11yRulesSeverity)).addRule(...getAngularEslintTemplatePluginRuleSeverity("table-scope", a11yRulesSeverity)).addRule(...getAngularEslintTemplatePluginRuleSeverity("use-track-by-function", requireLoopIndexes ? ERROR : OFF)).addRule(...getAngularEslintTemplatePluginRuleSeverity("valid-aria", a11yRulesSeverity)).addOverrides();
|
|
95
|
+
return {
|
|
96
|
+
configs: [configBuilderGeneral, configBuilderTemplate],
|
|
97
|
+
optionsResolved
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
//#endregion
|
|
102
|
+
export { angularUnConfig };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ERROR, GLOB_ASTRO, OFF, WARNING, assignDefaults, createConfigBuilder, interopDefault, pluginsLoaders } from "./eslint-CA-T1mGF.js";
|
|
2
|
+
|
|
3
|
+
//#region src/configs/astro.ts
|
|
4
|
+
const DEFAULT_ASTRO_FILES = [GLOB_ASTRO];
|
|
5
|
+
const astroUnConfig = async (context) => {
|
|
6
|
+
const [eslintPluginAstro, { parser: typescriptEslintParser }] = await Promise.all([pluginsLoaders.astro(context).then(({ module }) => module), interopDefault(import("typescript-eslint"))]);
|
|
7
|
+
if (!eslintPluginAstro) return null;
|
|
8
|
+
const optionsRaw = context.rootOptions.configs?.astro;
|
|
9
|
+
const optionsResolved = assignDefaults(optionsRaw, {
|
|
10
|
+
files: DEFAULT_ASTRO_FILES,
|
|
11
|
+
configJsxA11y: true
|
|
12
|
+
});
|
|
13
|
+
const { files: parentConfigFiles, ignores: parentConfigIgnores, configJsxA11y } = optionsResolved;
|
|
14
|
+
const configBuilder = createConfigBuilder(context, optionsResolved, "astro");
|
|
15
|
+
const isTypescriptEnabled = context.configsMeta.ts.enabled;
|
|
16
|
+
configBuilder?.addConfig(["astro/setup", {
|
|
17
|
+
filesFallback: [...DEFAULT_ASTRO_FILES, ...parentConfigFiles],
|
|
18
|
+
doNotIgnoreMarkdown: true,
|
|
19
|
+
parser: "astro-eslint-parser"
|
|
20
|
+
}], {
|
|
21
|
+
languageOptions: {
|
|
22
|
+
globals: eslintPluginAstro.environments.astro.globals,
|
|
23
|
+
parserOptions: { parser: isTypescriptEnabled ? typescriptEslintParser : void 0 },
|
|
24
|
+
sourceType: "module"
|
|
25
|
+
},
|
|
26
|
+
...isTypescriptEnabled && { processor: eslintPluginAstro.processors["client-side-ts"] }
|
|
27
|
+
});
|
|
28
|
+
configBuilder?.addConfig(["astro", {
|
|
29
|
+
doNotIgnoreMarkdown: true,
|
|
30
|
+
includeDefaultFilesAndIgnores: true,
|
|
31
|
+
filesFallback: DEFAULT_ASTRO_FILES
|
|
32
|
+
}]).addRule("missing-client-only-directive-value", ERROR).addRule("no-conflict-set-directives", ERROR).addRule("no-deprecated-astro-canonicalurl", ERROR).addRule("no-deprecated-astro-fetchcontent", ERROR).addRule("no-deprecated-astro-resolve", ERROR).addRule("no-deprecated-getentrybyslug", ERROR).addRule("no-exports-from-components", ERROR).addRule("no-unused-define-vars-in-style", ERROR).addRule("valid-compile", ERROR).addRule("no-set-html-directive", ERROR).addRule("no-set-text-directive", OFF).addRule("no-unused-css-selector", WARNING).addRule("prefer-class-list-directive", ERROR).addRule("prefer-object-class-list", ERROR).addRule("prefer-split-class-list", ERROR).addRule("sort-attributes", ERROR).addRule("semi", OFF).addOverrides();
|
|
33
|
+
return {
|
|
34
|
+
configs: [configBuilder, ...configJsxA11y === false ? [] : await (async () => {
|
|
35
|
+
const { jsxA11yUnConfig } = await import("./jsx-a11y-V0-wCeTY.js");
|
|
36
|
+
const result = await jsxA11yUnConfig(context, {
|
|
37
|
+
prefix: "astro",
|
|
38
|
+
options: {
|
|
39
|
+
files: parentConfigFiles,
|
|
40
|
+
ignores: parentConfigIgnores,
|
|
41
|
+
...typeof configJsxA11y === "object" && configJsxA11y
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
return result?.configs || [];
|
|
45
|
+
})()],
|
|
46
|
+
optionsResolved
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
//#endregion
|
|
51
|
+
export { astroUnConfig };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ERROR, GLOB_JS_TS_X_EXTENSION, OFF, WARNING, assignDefaults, createConfigBuilder } from "./eslint-CA-T1mGF.js";
|
|
2
|
+
import { RULES_TO_DISABLE_IN_TEST_FILES, generateConfigNoOnlyTestsBuilder, generateDefaultTestFiles } from "./shared-CjK2SSQm.js";
|
|
3
|
+
|
|
4
|
+
//#region src/configs/ava.ts
|
|
5
|
+
const avaUnConfig = (context) => {
|
|
6
|
+
const optionsRaw = context.rootOptions.configs?.ava;
|
|
7
|
+
const optionsResolved = assignDefaults(optionsRaw, { configNoOnlyTests: false });
|
|
8
|
+
const { configNoOnlyTests, enforceAssertionMessage, enforceMaxAssertions } = optionsResolved;
|
|
9
|
+
const configBuilder = createConfigBuilder(context, optionsResolved, "ava");
|
|
10
|
+
const configFilesFallback = generateDefaultTestFiles(GLOB_JS_TS_X_EXTENSION);
|
|
11
|
+
configBuilder?.addConfig(["ava", {
|
|
12
|
+
includeDefaultFilesAndIgnores: true,
|
|
13
|
+
filesFallback: configFilesFallback
|
|
14
|
+
}]).addRule("assertion-arguments", ERROR, enforceAssertionMessage == null ? [] : [{ message: enforceAssertionMessage ? "always" : "never" }]).addRule("hooks-order", ERROR).addRule("max-asserts", enforceMaxAssertions == null ? OFF : ERROR, enforceMaxAssertions == null ? [] : [enforceMaxAssertions]).addRule("no-async-fn-without-await", ERROR).addRule("no-duplicate-modifiers", ERROR).addRule("no-identical-title", ERROR).addRule("no-ignored-test-files", ERROR).addRule("no-import-test-files", ERROR).addRule("no-incorrect-deep-equal", ERROR).addRule("no-inline-assertions", ERROR).addRule("no-nested-tests", ERROR).addRule("no-only-test", ERROR).addRule("no-skip-assert", ERROR).addRule("no-skip-test", ERROR).addRule("no-todo-implementation", ERROR).addRule("no-todo-test", WARNING).addRule("no-unknown-modifiers", ERROR).addRule("prefer-async-await", ERROR).addRule("prefer-power-assert", OFF).addRule("prefer-t-regex", ERROR).addRule("test-title", ERROR).addRule("test-title-format", OFF).addRule("use-t", ERROR).addRule("use-t-throws-async-well", ERROR).addRule("use-t-well", ERROR).addRule("use-test", ERROR).addRule("use-true-false", ERROR).disableBulkRules(RULES_TO_DISABLE_IN_TEST_FILES).addOverrides();
|
|
15
|
+
const configBuilderNoOnlyTests = generateConfigNoOnlyTestsBuilder(context, "ava", configNoOnlyTests, optionsResolved, { filesFallback: configFilesFallback });
|
|
16
|
+
return {
|
|
17
|
+
configs: [configBuilder, configBuilderNoOnlyTests],
|
|
18
|
+
optionsResolved
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { avaUnConfig };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ERROR, OFF, WARNING, assignDefaults, createConfigBuilder } from "./eslint-CA-T1mGF.js";
|
|
2
|
+
|
|
3
|
+
//#region src/configs/better-tailwind.ts
|
|
4
|
+
const betterTailwindUnConfig = (context) => {
|
|
5
|
+
const optionsRaw = context.rootOptions.configs?.betterTailwind;
|
|
6
|
+
const optionsResolved = assignDefaults(optionsRaw, {});
|
|
7
|
+
const { settings: pluginSettings, breakUpClassesIntoMultipleLines, restrictedClasses } = optionsResolved;
|
|
8
|
+
const tailwindPackageInfo = context.packagesInfo.tailwindcss;
|
|
9
|
+
const tailwindRealMajorVersion = tailwindPackageInfo?.versions.major;
|
|
10
|
+
const tailwindMajorVersion = tailwindRealMajorVersion === 3 ? 3 : 4;
|
|
11
|
+
if (tailwindRealMajorVersion === 4 && !pluginSettings?.entryPoint) context.logger.warn("[betterTailwind] You haven't specified `settings.entryPoint` option which is required for `eslint-plugin-better-tailwindcss` to work properly with Tailwind 4");
|
|
12
|
+
if (tailwindRealMajorVersion != null && (tailwindRealMajorVersion < 3 || tailwindRealMajorVersion > 4)) context.logger.warn("[betterTailwind] The detected Tailwind version is not supported by `eslint-plugin-better-tailwindcss`");
|
|
13
|
+
const configBuilder = createConfigBuilder(context, optionsResolved, "better-tailwindcss");
|
|
14
|
+
configBuilder?.addConfig(["better-tailwindcss", { includeDefaultFilesAndIgnores: true }], { ...pluginSettings && { settings: { "better-tailwindcss": pluginSettings } } }).addRule("enforce-consistent-variable-syntax", tailwindMajorVersion === 3 ? OFF : WARNING).addRule("enforce-consistent-line-wrapping", breakUpClassesIntoMultipleLines ? WARNING : OFF, breakUpClassesIntoMultipleLines ? [breakUpClassesIntoMultipleLines] : []).addRule("no-duplicate-classes", WARNING).addRule("no-unnecessary-whitespace", WARNING).addRule("enforce-consistent-class-order", WARNING).addRule("no-conflicting-classes", ERROR).addRule("no-restricted-classes", restrictedClasses?.length ? ERROR : OFF, restrictedClasses?.length ? [{ restrict: restrictedClasses }] : []).addRule("no-unregistered-classes", OFF).addOverrides();
|
|
15
|
+
return {
|
|
16
|
+
configs: [configBuilder],
|
|
17
|
+
optionsResolved
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
export { betterTailwindUnConfig };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ERROR, assignDefaults, createConfigBuilder } from "./eslint-CA-T1mGF.js";
|
|
2
|
+
|
|
3
|
+
//#region src/configs/case-police.ts
|
|
4
|
+
const casePoliceUnConfig = (context) => {
|
|
5
|
+
const optionsRaw = context.rootOptions.configs?.casePolice;
|
|
6
|
+
const optionsResolved = assignDefaults(optionsRaw, {});
|
|
7
|
+
const configBuilder = createConfigBuilder(context, optionsResolved, "case-police");
|
|
8
|
+
configBuilder?.addConfig(["case-police", {
|
|
9
|
+
includeDefaultFilesAndIgnores: true,
|
|
10
|
+
doNotIgnoreCss: true,
|
|
11
|
+
doNotIgnoreHtml: true,
|
|
12
|
+
doNotIgnoreMarkdown: true,
|
|
13
|
+
doNotIgnoreMdx: true
|
|
14
|
+
}]).addRule("string-check", ERROR, [], { disableAutofix: true }).addOverrides();
|
|
15
|
+
return {
|
|
16
|
+
configs: [configBuilder],
|
|
17
|
+
optionsResolved
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
export { casePoliceUnConfig };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ERROR, GLOB_JS_TS_EXTENSION, assignDefaults, createConfigBuilder } from "./eslint-CA-T1mGF.js";
|
|
2
|
+
|
|
3
|
+
//#region src/configs/extra/cli.ts
|
|
4
|
+
const DEFAULT_CLI_DIRS = [
|
|
5
|
+
"bin",
|
|
6
|
+
"scripts",
|
|
7
|
+
"cli"
|
|
8
|
+
];
|
|
9
|
+
const DEFAULT_CLI_FILES = ["cli"];
|
|
10
|
+
const cliUnConfig = (context) => {
|
|
11
|
+
const optionsRaw = context.rootOptions.configs?.cli;
|
|
12
|
+
const optionsResolved = assignDefaults(optionsRaw, {});
|
|
13
|
+
const { onlyTopLevelDirs } = optionsResolved;
|
|
14
|
+
const configBuilder = createConfigBuilder(context, optionsResolved, null);
|
|
15
|
+
configBuilder?.addConfig(["cli", {
|
|
16
|
+
includeDefaultFilesAndIgnores: true,
|
|
17
|
+
filesFallback: [...DEFAULT_CLI_DIRS.map((dir) => `${onlyTopLevelDirs ? "" : "**/"}${dir}/**/*.${GLOB_JS_TS_EXTENSION}`), ...DEFAULT_CLI_FILES.map((file) => `${onlyTopLevelDirs ? "" : "**/"}${file}.${GLOB_JS_TS_EXTENSION}`)]
|
|
18
|
+
}]).disableAnyRule("node", "hashbang").disableAnyRule("node", "no-process-exit").disableAnyRule("unicorn", "no-process-exit").disableAnyRule("", "no-await-in-loop").disableAnyRule("", "no-console").disableAnyRule("import", "no-extraneous-dependencies").addAnyRule("unicorn", "prefer-top-level-await", ERROR).disableAnyRule("node", "no-top-level-await").addOverrides();
|
|
19
|
+
return {
|
|
20
|
+
configs: [configBuilder],
|
|
21
|
+
optionsResolved
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
export { cliUnConfig };
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { ERROR, OFF, assignDefaults, createConfigBuilder } from "./eslint-CA-T1mGF.js";
|
|
2
|
+
import { esUnConfig } from "./es-CvoaEvOg.js";
|
|
3
|
+
|
|
4
|
+
//#region src/configs/extra/cloudfront-functions.ts
|
|
5
|
+
const genSyntaxNotAllowedErrorMessage = (syntax, isPlural = false) => `${syntax} ${isPlural ? "are" : "is"} not allowed in CloudFront functions`;
|
|
6
|
+
const getAllowedImports = (isV2 = true) => [
|
|
7
|
+
"querystring",
|
|
8
|
+
"crypto",
|
|
9
|
+
isV2 && "cloudfront"
|
|
10
|
+
].filter((v) => typeof v === "string");
|
|
11
|
+
const cloudfrontFunctionsEslintConfig = async (context) => {
|
|
12
|
+
const optionsRaw = context.rootOptions.configs?.cloudfrontFunctions;
|
|
13
|
+
const optionsResolved = assignDefaults(optionsRaw, {});
|
|
14
|
+
const configs = await Promise.all([[1, optionsResolved.configV1 || {}], [2, optionsResolved]].map(async ([runtimeVersion, options]) => {
|
|
15
|
+
const isV2 = runtimeVersion === 2;
|
|
16
|
+
const { files, ignores } = options;
|
|
17
|
+
if (!files?.length && !ignores?.length) return [];
|
|
18
|
+
const configsEs = (await esUnConfig(context, {
|
|
19
|
+
prefix: `cloudfront-functions/v${runtimeVersion}/es-features`,
|
|
20
|
+
options: {
|
|
21
|
+
files,
|
|
22
|
+
ignores,
|
|
23
|
+
ecmaVersion: 5,
|
|
24
|
+
ecmaFeatures: {
|
|
25
|
+
5: {},
|
|
26
|
+
2015: {
|
|
27
|
+
arrowFunctions: true,
|
|
28
|
+
blockScopedVariables: isV2,
|
|
29
|
+
modules: true,
|
|
30
|
+
restParameters: true,
|
|
31
|
+
templateLiterals: true,
|
|
32
|
+
objectAssign: true,
|
|
33
|
+
objectIs: true,
|
|
34
|
+
objectSetPrototypeOf: true,
|
|
35
|
+
stringFromCodePoint: true,
|
|
36
|
+
stringPrototypeCodePointAt: true,
|
|
37
|
+
stringPrototypeEndsWith: true,
|
|
38
|
+
stringPrototypeIncludes: true,
|
|
39
|
+
stringPrototypeRepeat: true,
|
|
40
|
+
stringPrototypeStartsWith: true,
|
|
41
|
+
numberEpsilon: true,
|
|
42
|
+
numberIsFinite: true,
|
|
43
|
+
numberIsInteger: true,
|
|
44
|
+
numberIsNan: true,
|
|
45
|
+
numberIsSafeInteger: true,
|
|
46
|
+
numberMaxSafeInteger: true,
|
|
47
|
+
numberMinSafeInteger: true,
|
|
48
|
+
numberParseFloat: true,
|
|
49
|
+
numberParseInt: true,
|
|
50
|
+
mathAcosh: true,
|
|
51
|
+
mathAsinh: true,
|
|
52
|
+
mathAtanh: true,
|
|
53
|
+
mathCbrt: true,
|
|
54
|
+
mathClz32: true,
|
|
55
|
+
mathCosh: true,
|
|
56
|
+
mathExpm1: true,
|
|
57
|
+
mathFround: true,
|
|
58
|
+
mathHypot: true,
|
|
59
|
+
mathImul: true,
|
|
60
|
+
mathLog10: true,
|
|
61
|
+
mathLog1p: true,
|
|
62
|
+
mathLog2: true,
|
|
63
|
+
mathSign: true,
|
|
64
|
+
mathSinh: true,
|
|
65
|
+
mathTanh: true,
|
|
66
|
+
mathTrunc: true,
|
|
67
|
+
arrayOf: true,
|
|
68
|
+
arrayPrototypeCopyWithin: true,
|
|
69
|
+
arrayPrototypeFill: true,
|
|
70
|
+
arrayPrototypeFind: true,
|
|
71
|
+
arrayPrototypeFindIndex: true,
|
|
72
|
+
promise: true,
|
|
73
|
+
regexpPrototypeFlags: isV2,
|
|
74
|
+
typedArrays: true
|
|
75
|
+
},
|
|
76
|
+
2016: { arrayPrototypeIncludes: true },
|
|
77
|
+
2017: {
|
|
78
|
+
asyncFunctions: isV2,
|
|
79
|
+
objectEntries: true,
|
|
80
|
+
objectValues: true,
|
|
81
|
+
stringPrototypePadStartPadEnd: true
|
|
82
|
+
},
|
|
83
|
+
2018: {
|
|
84
|
+
regexpSFlag: isV2,
|
|
85
|
+
promisePrototypeFinally: true
|
|
86
|
+
},
|
|
87
|
+
2019: { stringPrototypeTrimStartTrimEnd: true },
|
|
88
|
+
2020: { promiseAllSettled: isV2 },
|
|
89
|
+
2021: {
|
|
90
|
+
stringPrototypeReplaceAll: isV2,
|
|
91
|
+
numericSeparators: isV2,
|
|
92
|
+
promiseAny: isV2
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}))?.configs || [];
|
|
97
|
+
const allowedImports = getAllowedImports(isV2);
|
|
98
|
+
const configBuilder = createConfigBuilder(context, options, "");
|
|
99
|
+
configBuilder?.addConfig([`cloudfront-functions/v${runtimeVersion}`, { includeDefaultFilesAndIgnores: true }]).addAnyRule("", "no-unused-vars", ERROR, [{ varsIgnorePattern: "^handler$" }]).addRule("no-var", isV2 ? null : OFF).addRule("prefer-destructuring", OFF).addRule("prefer-object-has-own", OFF).addRule("vars-on-top", isV2 ? null : OFF).addAnyRule("unicorn", "prefer-logical-operator-over-ternary", OFF).addAnyRule("node", "prefer-node-protocol", OFF).addRule("no-restricted-syntax", ERROR, [
|
|
100
|
+
{
|
|
101
|
+
selector: "ExportNamedDeclaration",
|
|
102
|
+
message: genSyntaxNotAllowedErrorMessage("Named export statements", true)
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
selector: "ExportDefaultDeclaration",
|
|
106
|
+
message: genSyntaxNotAllowedErrorMessage("Default export statements", true)
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
selector: "ExportAllDeclaration",
|
|
110
|
+
message: genSyntaxNotAllowedErrorMessage("Re-export statements (export * from ...)", true)
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
selector: "CallExpression[callee.name='eval']",
|
|
114
|
+
message: genSyntaxNotAllowedErrorMessage("Use of `eval`")
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
selector: "NewExpression[callee.name='Function']",
|
|
118
|
+
message: genSyntaxNotAllowedErrorMessage("Use of `new Function()`")
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
selector: `ImportDeclaration:${allowedImports.map((module) => `not([source.value='${module}'])`).join(":")}`,
|
|
122
|
+
message: `Only specific modules are allowed to be imported in CloudFront functions: ${allowedImports.map((module) => `\`${module}\``).join(", ")}.`
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
selector: `CallExpression[callee.name='require']:${allowedImports.map((module) => `not([arguments.0.value='${module}'])`).join(":")}`,
|
|
126
|
+
message: `Only specific modules are allowed to be required in CloudFront functions: ${allowedImports.map((module) => `\`${module}\``).join(", ")}.`
|
|
127
|
+
}
|
|
128
|
+
]).addRule("no-restricted-globals", ERROR, [
|
|
129
|
+
{
|
|
130
|
+
name: "setTimeout",
|
|
131
|
+
message: genSyntaxNotAllowedErrorMessage("`setTimeout`")
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
name: "clearTimeout",
|
|
135
|
+
message: genSyntaxNotAllowedErrorMessage("`clearTimeout`")
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
name: "setImmediate",
|
|
139
|
+
message: genSyntaxNotAllowedErrorMessage("`setImmediate`")
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
name: "process",
|
|
143
|
+
message: genSyntaxNotAllowedErrorMessage("Use of the `process` global")
|
|
144
|
+
}
|
|
145
|
+
]).addAnyRule("node", "no-missing-import", ERROR, [{ allowModules: allowedImports }]).addAnyRule("node", "no-missing-require", ERROR, [{ allowModules: allowedImports }]).addOverrides();
|
|
146
|
+
return [...configsEs, configBuilder];
|
|
147
|
+
}));
|
|
148
|
+
return {
|
|
149
|
+
configs: configs.flat(),
|
|
150
|
+
optionsResolved
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
//#endregion
|
|
155
|
+
export { cloudfrontFunctionsEslintConfig };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ERROR, assignDefaults, createConfigBuilder } from "./eslint-CA-T1mGF.js";
|
|
2
|
+
|
|
3
|
+
//#region src/configs/compat.ts
|
|
4
|
+
const compatUnConfig = (context) => {
|
|
5
|
+
const optionsRaw = context.rootOptions.configs?.compat;
|
|
6
|
+
const optionsResolved = assignDefaults(optionsRaw, {});
|
|
7
|
+
const { settings: pluginSettings } = optionsResolved;
|
|
8
|
+
const configBuilder = createConfigBuilder(context, optionsResolved, "compat");
|
|
9
|
+
configBuilder?.addConfig(["compat", { includeDefaultFilesAndIgnores: true }], { ...pluginSettings && { settings: pluginSettings } }).addRule("compat", ERROR).addOverrides();
|
|
10
|
+
return {
|
|
11
|
+
configs: [configBuilder],
|
|
12
|
+
optionsResolved
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
export { compatUnConfig };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ERROR, assignDefaults, createConfigBuilder } from "./eslint-CA-T1mGF.js";
|
|
2
|
+
|
|
3
|
+
//#region src/configs/cspell.ts
|
|
4
|
+
const cspellUnConfig = (context) => {
|
|
5
|
+
const optionsRaw = context.rootOptions.configs?.cspell;
|
|
6
|
+
const optionsResolved = assignDefaults(optionsRaw, {});
|
|
7
|
+
const { options } = optionsResolved;
|
|
8
|
+
const configBuilder = createConfigBuilder(context, optionsResolved, "@cspell");
|
|
9
|
+
configBuilder?.addConfig(["cspell", {
|
|
10
|
+
includeDefaultFilesAndIgnores: true,
|
|
11
|
+
doNotIgnoreCss: true,
|
|
12
|
+
doNotIgnoreHtml: true,
|
|
13
|
+
doNotIgnoreMarkdown: true,
|
|
14
|
+
doNotIgnoreMdx: true
|
|
15
|
+
}]).addRule("spellchecker", ERROR, options ? [options] : []).addOverrides();
|
|
16
|
+
return {
|
|
17
|
+
configs: [configBuilder],
|
|
18
|
+
optionsResolved
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { cspellUnConfig };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ERROR, GLOB_CSS, OFF, WARNING, assignDefaults, createConfigBuilder, getKeysOfTruthyValues, interopDefault } from "./eslint-CA-T1mGF.js";
|
|
2
|
+
|
|
3
|
+
//#region src/configs/css.ts
|
|
4
|
+
const cssUnConfig = async (context) => {
|
|
5
|
+
const { tailwindSyntax } = await interopDefault(import("@eslint/css/syntax"));
|
|
6
|
+
const optionsRaw = context.rootOptions.configs?.css;
|
|
7
|
+
const optionsResolved = assignDefaults(optionsRaw, { tolerantMode: false });
|
|
8
|
+
const { tolerantMode, customSyntax, allowedFontUnits } = optionsResolved;
|
|
9
|
+
const configBuilder = createConfigBuilder(context, optionsResolved, "css");
|
|
10
|
+
const isTailwindEnabled = context.configsMeta.tailwind.enabled;
|
|
11
|
+
configBuilder?.addConfig(["css", {
|
|
12
|
+
includeDefaultFilesAndIgnores: true,
|
|
13
|
+
filesFallback: [GLOB_CSS],
|
|
14
|
+
doNotIgnoreCss: true
|
|
15
|
+
}], {
|
|
16
|
+
language: "css/css",
|
|
17
|
+
languageOptions: {
|
|
18
|
+
...tolerantMode && { tolerant: true },
|
|
19
|
+
customSyntax: {
|
|
20
|
+
...isTailwindEnabled && tailwindSyntax,
|
|
21
|
+
...customSyntax
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}).addRule("no-duplicate-imports", ERROR).addRule("no-empty-blocks", ERROR).addRule("no-important", WARNING).addRule("no-invalid-at-rules", ERROR).addRule("no-invalid-properties", ERROR).addRule("relative-font-units", ERROR, [{ allowUnits: getKeysOfTruthyValues({
|
|
25
|
+
rem: true,
|
|
26
|
+
em: true,
|
|
27
|
+
...allowedFontUnits
|
|
28
|
+
}) }]).addRule("prefer-logical-properties", OFF).addRule("use-baseline", WARNING).addRule("use-layers", OFF).addOverrides();
|
|
29
|
+
return {
|
|
30
|
+
configs: [configBuilder],
|
|
31
|
+
optionsResolved
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
//#endregion
|
|
36
|
+
export { cssUnConfig };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ERROR, assignDefaults, createConfigBuilder } from "./eslint-CA-T1mGF.js";
|
|
2
|
+
|
|
3
|
+
//#region src/configs/css-in-js.ts
|
|
4
|
+
const cssInJsUnConfig = (context) => {
|
|
5
|
+
const optionsRaw = context.rootOptions.configs?.cssInJs;
|
|
6
|
+
const optionsResolved = assignDefaults(optionsRaw, {
|
|
7
|
+
hexColorsStyle: "long",
|
|
8
|
+
avoidLeadingZero: false,
|
|
9
|
+
propertyCasing: "camelCase"
|
|
10
|
+
});
|
|
11
|
+
const { settings: pluginSettings, hexColorsStyle, preferNamedColors: preferNamedColorsRaw, avoidLeadingZero, propertyCasing } = optionsResolved;
|
|
12
|
+
const preferNamedColors = typeof preferNamedColorsRaw === "object" ? preferNamedColorsRaw : { flag: preferNamedColorsRaw ?? false };
|
|
13
|
+
const configBuilder = createConfigBuilder(context, optionsResolved, "css-in-js");
|
|
14
|
+
configBuilder?.addConfig(["css-in-js", { includeDefaultFilesAndIgnores: true }], { ...pluginSettings && { settings: { css: pluginSettings } } }).addRule("color-hex-style", ERROR, [hexColorsStyle === "long" ? "RRGGBB" : "RGB"]).addRule("named-color", ERROR, [preferNamedColors.flag ? "always" : "never", { ...preferNamedColors.ignoreProperties?.length && { ignoreProperties: preferNamedColors.ignoreProperties } }]).addRule("no-dupe-properties", ERROR).addRule("no-invalid-color-hex", ERROR).addRule("no-length-zero-unit", ERROR).addRule("no-number-trailing-zeros", ERROR).addRule("no-shorthand-property-overrides", ERROR).addRule("no-unknown-property", ERROR).addRule("no-unknown-unit", ERROR).addRule("no-useless-color-alpha", ERROR).addRule("number-leading-zero", ERROR, [avoidLeadingZero ? "never" : "always"]).addRule("prefer-reduce-shorthand-property-box-values", ERROR).addRule("property-casing", ERROR, [propertyCasing]).addOverrides();
|
|
15
|
+
return {
|
|
16
|
+
configs: [configBuilder],
|
|
17
|
+
optionsResolved
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
export { cssInJsUnConfig };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ERROR, GLOB_JS_TS_X_EXTENSION, OFF, WARNING, assignDefaults, createConfigBuilder } from "./eslint-CA-T1mGF.js";
|
|
2
|
+
import { RULES_TO_DISABLE_IN_TEST_FILES, generateConfigNoOnlyTestsBuilder, generateDefaultTestFiles } from "./shared-CjK2SSQm.js";
|
|
3
|
+
|
|
4
|
+
//#region src/configs/cypress.ts
|
|
5
|
+
const cypressUnConfig = (context) => {
|
|
6
|
+
const optionsRaw = context.rootOptions.configs?.cypress;
|
|
7
|
+
const optionsResolved = assignDefaults(optionsRaw, { configNoOnlyTests: true });
|
|
8
|
+
const { configNoOnlyTests } = optionsResolved;
|
|
9
|
+
const configBuilder = createConfigBuilder(context, optionsResolved, "cypress");
|
|
10
|
+
const configFilesFallback = generateDefaultTestFiles(GLOB_JS_TS_X_EXTENSION, { includeCypressTests: true });
|
|
11
|
+
configBuilder?.addConfig(["cypress", {
|
|
12
|
+
includeDefaultFilesAndIgnores: true,
|
|
13
|
+
filesFallback: configFilesFallback
|
|
14
|
+
}]).addRule("assertion-before-screenshot", WARNING).addRule("no-assigning-return-values", ERROR).addRule("no-async-before", ERROR).addRule("no-async-tests", ERROR).addRule("no-chained-get", WARNING).addRule("no-debug", ERROR).addRule("no-force", WARNING).addRule("no-pause", ERROR).addRule("no-unnecessary-waiting", ERROR).addRule("no-xpath", OFF).addRule("require-data-selectors", OFF).addRule("unsafe-to-chain-command", ERROR).disableBulkRules(RULES_TO_DISABLE_IN_TEST_FILES).addOverrides();
|
|
15
|
+
const configBuilderNoOnlyTests = generateConfigNoOnlyTestsBuilder(context, "cypress", configNoOnlyTests, optionsResolved, { filesFallback: configFilesFallback });
|
|
16
|
+
return {
|
|
17
|
+
configs: [configBuilder, configBuilderNoOnlyTests],
|
|
18
|
+
optionsResolved
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { cypressUnConfig };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ERROR, assignDefaults, createConfigBuilder } from "./eslint-CA-T1mGF.js";
|
|
2
|
+
|
|
3
|
+
//#region src/configs/de-morgan.ts
|
|
4
|
+
const deMorganUnConfig = (context) => {
|
|
5
|
+
const optionsRaw = context.rootOptions.configs?.deMorgan;
|
|
6
|
+
const optionsResolved = assignDefaults(optionsRaw, {});
|
|
7
|
+
const configBuilder = createConfigBuilder(context, optionsResolved, "de-morgan");
|
|
8
|
+
configBuilder?.addConfig(["de-morgan", {
|
|
9
|
+
includeDefaultFilesAndIgnores: true,
|
|
10
|
+
doNotIgnoreHtml: true
|
|
11
|
+
}]).addRule("no-negated-conjunction", ERROR).addRule("no-negated-disjunction", ERROR).addOverrides();
|
|
12
|
+
return {
|
|
13
|
+
configs: [configBuilder],
|
|
14
|
+
optionsResolved
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
export { deMorganUnConfig };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ERROR, assignDefaults, createConfigBuilder, interopDefault } from "./eslint-CA-T1mGF.js";
|
|
2
|
+
import { DEFAULT_FILES_PACKAGE_JSON } from "./package-json-DiWZz25w.js";
|
|
3
|
+
|
|
4
|
+
//#region src/configs/depend.ts
|
|
5
|
+
const dependUnConfig = async (context) => {
|
|
6
|
+
const jsoncEslintParser = await interopDefault(import("jsonc-eslint-parser"));
|
|
7
|
+
const optionsRaw = context.rootOptions.configs?.depend;
|
|
8
|
+
const optionsResolved = assignDefaults(optionsRaw, {});
|
|
9
|
+
const { options: badDependencyOptions } = optionsResolved;
|
|
10
|
+
const configBuilder = createConfigBuilder(context, optionsResolved, "depend");
|
|
11
|
+
configBuilder?.addConfig(["depend", {
|
|
12
|
+
includeDefaultFilesAndIgnores: true,
|
|
13
|
+
filesFallback: DEFAULT_FILES_PACKAGE_JSON
|
|
14
|
+
}], { languageOptions: { parser: jsoncEslintParser } }).addRule("ban-dependencies", ERROR, badDependencyOptions ? [badDependencyOptions] : []).addOverrides();
|
|
15
|
+
return {
|
|
16
|
+
configs: [configBuilder],
|
|
17
|
+
optionsResolved
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
export { dependUnConfig };
|