@shayanthenerd/eslint-config 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +496 -0
- package/dist/_virtual/rolldown_runtime.cjs +30 -0
- package/dist/configs/base.cjs +44 -0
- package/dist/configs/base.js +43 -0
- package/dist/configs/commons.cjs +26 -0
- package/dist/configs/commons.js +25 -0
- package/dist/configs/css.cjs +29 -0
- package/dist/configs/css.js +28 -0
- package/dist/configs/cypress.cjs +23 -0
- package/dist/configs/cypress.js +22 -0
- package/dist/configs/html.cjs +23 -0
- package/dist/configs/html.js +22 -0
- package/dist/configs/importX.cjs +26 -0
- package/dist/configs/importX.js +25 -0
- package/dist/configs/nuxtMultiRootTemplate.cjs +14 -0
- package/dist/configs/nuxtMultiRootTemplate.js +14 -0
- package/dist/configs/oxlintOverrides.cjs +49 -0
- package/dist/configs/oxlintOverrides.js +48 -0
- package/dist/configs/perfectionist.cjs +24 -0
- package/dist/configs/perfectionist.js +23 -0
- package/dist/configs/playwright.cjs +23 -0
- package/dist/configs/playwright.js +22 -0
- package/dist/configs/storybook.cjs +24 -0
- package/dist/configs/storybook.js +23 -0
- package/dist/configs/stylistic.cjs +23 -0
- package/dist/configs/stylistic.js +22 -0
- package/dist/configs/tailwind.cjs +43 -0
- package/dist/configs/tailwind.js +42 -0
- package/dist/configs/typescript.cjs +31 -0
- package/dist/configs/typescript.js +30 -0
- package/dist/configs/vitest.cjs +23 -0
- package/dist/configs/vitest.js +22 -0
- package/dist/configs/vue.cjs +35 -0
- package/dist/configs/vue.js +34 -0
- package/dist/configs/vueComponentNames.cjs +19 -0
- package/dist/configs/vueComponentNames.js +19 -0
- package/dist/index.cjs +55 -0
- package/dist/index.d.cts +16 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +54 -0
- package/dist/oxlint.config.jsonc +192 -0
- package/dist/prettier.config.js +42 -0
- package/dist/rules/css.cjs +65 -0
- package/dist/rules/css.js +65 -0
- package/dist/rules/cypress.cjs +16 -0
- package/dist/rules/cypress.js +15 -0
- package/dist/rules/html.cjs +53 -0
- package/dist/rules/html.js +53 -0
- package/dist/rules/importX.cjs +51 -0
- package/dist/rules/importX.js +50 -0
- package/dist/rules/javascript.cjs +164 -0
- package/dist/rules/javascript.js +163 -0
- package/dist/rules/perfectionist.cjs +73 -0
- package/dist/rules/perfectionist.js +73 -0
- package/dist/rules/playwright.cjs +28 -0
- package/dist/rules/playwright.js +27 -0
- package/dist/rules/storybook.cjs +16 -0
- package/dist/rules/storybook.js +15 -0
- package/dist/rules/stylistic.cjs +160 -0
- package/dist/rules/stylistic.js +160 -0
- package/dist/rules/tailwind.cjs +36 -0
- package/dist/rules/tailwind.js +36 -0
- package/dist/rules/typescript.cjs +62 -0
- package/dist/rules/typescript.js +62 -0
- package/dist/rules/vitest.cjs +47 -0
- package/dist/rules/vitest.js +46 -0
- package/dist/rules/vue.cjs +169 -0
- package/dist/rules/vue.js +169 -0
- package/dist/rules/vueAccessibility.cjs +23 -0
- package/dist/rules/vueAccessibility.js +23 -0
- package/dist/types/configOptions/base.d.cts +47 -0
- package/dist/types/configOptions/base.d.ts +47 -0
- package/dist/types/configOptions/css.d.cts +27 -0
- package/dist/types/configOptions/css.d.ts +27 -0
- package/dist/types/configOptions/html.d.cts +27 -0
- package/dist/types/configOptions/html.d.ts +27 -0
- package/dist/types/configOptions/importX.d.cts +20 -0
- package/dist/types/configOptions/importX.d.ts +20 -0
- package/dist/types/configOptions/nuxt.d.cts +42 -0
- package/dist/types/configOptions/nuxt.d.ts +42 -0
- package/dist/types/configOptions/perfectionist.d.cts +16 -0
- package/dist/types/configOptions/perfectionist.d.ts +16 -0
- package/dist/types/configOptions/stylistic.d.cts +145 -0
- package/dist/types/configOptions/stylistic.d.ts +145 -0
- package/dist/types/configOptions/tailwind.d.cts +46 -0
- package/dist/types/configOptions/tailwind.d.ts +46 -0
- package/dist/types/configOptions/test.d.cts +55 -0
- package/dist/types/configOptions/test.d.ts +55 -0
- package/dist/types/configOptions/typescript.d.cts +36 -0
- package/dist/types/configOptions/typescript.d.ts +36 -0
- package/dist/types/configOptions/vue.d.cts +211 -0
- package/dist/types/configOptions/vue.d.ts +211 -0
- package/dist/types/configOptions/vueAccessibility.d.cts +34 -0
- package/dist/types/configOptions/vueAccessibility.d.ts +34 -0
- package/dist/types/eslint-schema.d.cts +13258 -0
- package/dist/types/eslint-schema.d.ts +13258 -0
- package/dist/types/eslintRules.d.cts +12 -0
- package/dist/types/eslintRules.d.ts +12 -0
- package/dist/types/helpers.d.cts +5 -0
- package/dist/types/helpers.d.ts +5 -0
- package/dist/types/index.d.cts +360 -0
- package/dist/types/index.d.ts +360 -0
- package/dist/utils/globs.cjs +31 -0
- package/dist/utils/globs.js +30 -0
- package/dist/utils/ignores/defaultIgnorePatterns.cjs +58 -0
- package/dist/utils/ignores/defaultIgnorePatterns.js +57 -0
- package/dist/utils/ignores/getIgnorePatterns.cjs +16 -0
- package/dist/utils/ignores/getIgnorePatterns.js +16 -0
- package/dist/utils/ignores/resolveGitignorePatterns.cjs +27 -0
- package/dist/utils/ignores/resolveGitignorePatterns.js +26 -0
- package/dist/utils/isEmptyString.cjs +8 -0
- package/dist/utils/isEmptyString.js +7 -0
- package/dist/utils/isEnabled.cjs +8 -0
- package/dist/utils/isEnabled.js +7 -0
- package/dist/utils/isPackageDetected.cjs +22 -0
- package/dist/utils/isPackageDetected.js +20 -0
- package/dist/utils/options/defaultOptions.cjs +168 -0
- package/dist/utils/options/defaultOptions.js +167 -0
- package/dist/utils/options/enableDetectedConfigs.cjs +36 -0
- package/dist/utils/options/enableDetectedConfigs.js +36 -0
- package/dist/utils/options/mergeWithDefaults.cjs +22 -0
- package/dist/utils/options/mergeWithDefaults.js +21 -0
- package/dist/utils/vue/getRestrictedVueElements.cjs +28 -0
- package/dist/utils/vue/getRestrictedVueElements.js +27 -0
- package/dist/utils/vue/getRestrictedVueInputs.cjs +24 -0
- package/dist/utils/vue/getRestrictedVueInputs.js +23 -0
- package/package.json +130 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
const require__Users_shayan_Desktop_Dev_GitHub_eslint_config_src_utils_isEnabled = require('../utils/isEnabled.cjs');
|
|
2
|
+
const require__Users_shayan_Desktop_Dev_GitHub_eslint_config_src_utils_options_defaultOptions = require('../utils/options/defaultOptions.cjs');
|
|
3
|
+
|
|
4
|
+
//#region src/rules/css.ts
|
|
5
|
+
const allowedPhysicalUnits = [
|
|
6
|
+
"cqh",
|
|
7
|
+
"cqw",
|
|
8
|
+
"dvh",
|
|
9
|
+
"dvw",
|
|
10
|
+
"lvh",
|
|
11
|
+
"lvw",
|
|
12
|
+
"svh",
|
|
13
|
+
"svw",
|
|
14
|
+
"vh",
|
|
15
|
+
"vw"
|
|
16
|
+
];
|
|
17
|
+
const allowedPhysicalProperties = [
|
|
18
|
+
"bottom",
|
|
19
|
+
"border-bottom",
|
|
20
|
+
"border-bottom-color",
|
|
21
|
+
"border-bottom-style",
|
|
22
|
+
"border-bottom-width",
|
|
23
|
+
"border-top",
|
|
24
|
+
"border-top-color",
|
|
25
|
+
"border-top-style",
|
|
26
|
+
"border-top-width",
|
|
27
|
+
"contain-intrinsic-height",
|
|
28
|
+
"contain-intrinsic-width",
|
|
29
|
+
"height",
|
|
30
|
+
"margin-bottom",
|
|
31
|
+
"margin-top",
|
|
32
|
+
"max-height",
|
|
33
|
+
"max-width",
|
|
34
|
+
"min-height",
|
|
35
|
+
"min-width",
|
|
36
|
+
"overflow-x",
|
|
37
|
+
"overflow-y",
|
|
38
|
+
"overscroll-behavior-x",
|
|
39
|
+
"overscroll-behavior-y",
|
|
40
|
+
"padding-bottom",
|
|
41
|
+
"padding-top",
|
|
42
|
+
"scroll-margin-bottom",
|
|
43
|
+
"scroll-margin-top",
|
|
44
|
+
"scroll-padding-bottom",
|
|
45
|
+
"scroll-padding-top",
|
|
46
|
+
"top",
|
|
47
|
+
"width"
|
|
48
|
+
];
|
|
49
|
+
function getCSSRules(options) {
|
|
50
|
+
const { css } = options.configs;
|
|
51
|
+
const { useBaseline, allowedRelativeFontUnits } = require__Users_shayan_Desktop_Dev_GitHub_eslint_config_src_utils_isEnabled.isEnabled(css) ? css : require__Users_shayan_Desktop_Dev_GitHub_eslint_config_src_utils_options_defaultOptions.defaultOptions.configs.css;
|
|
52
|
+
const cssRules = {
|
|
53
|
+
"css/no-invalid-properties": ["error", { allowUnknownVariables: true }],
|
|
54
|
+
"css/relative-font-units": ["warn", { allowUnits: allowedRelativeFontUnits }],
|
|
55
|
+
"css/use-baseline": useBaseline ? ["warn", { available: useBaseline }] : "off",
|
|
56
|
+
"css/prefer-logical-properties": ["error", {
|
|
57
|
+
allowUnits: allowedPhysicalUnits,
|
|
58
|
+
allowProperties: allowedPhysicalProperties
|
|
59
|
+
}]
|
|
60
|
+
};
|
|
61
|
+
return cssRules;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
//#endregion
|
|
65
|
+
exports.getCSSRules = getCSSRules;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { isEnabled } from "../utils/isEnabled.js";
|
|
2
|
+
import { defaultOptions } from "../utils/options/defaultOptions.js";
|
|
3
|
+
|
|
4
|
+
//#region src/rules/css.ts
|
|
5
|
+
const allowedPhysicalUnits = [
|
|
6
|
+
"cqh",
|
|
7
|
+
"cqw",
|
|
8
|
+
"dvh",
|
|
9
|
+
"dvw",
|
|
10
|
+
"lvh",
|
|
11
|
+
"lvw",
|
|
12
|
+
"svh",
|
|
13
|
+
"svw",
|
|
14
|
+
"vh",
|
|
15
|
+
"vw"
|
|
16
|
+
];
|
|
17
|
+
const allowedPhysicalProperties = [
|
|
18
|
+
"bottom",
|
|
19
|
+
"border-bottom",
|
|
20
|
+
"border-bottom-color",
|
|
21
|
+
"border-bottom-style",
|
|
22
|
+
"border-bottom-width",
|
|
23
|
+
"border-top",
|
|
24
|
+
"border-top-color",
|
|
25
|
+
"border-top-style",
|
|
26
|
+
"border-top-width",
|
|
27
|
+
"contain-intrinsic-height",
|
|
28
|
+
"contain-intrinsic-width",
|
|
29
|
+
"height",
|
|
30
|
+
"margin-bottom",
|
|
31
|
+
"margin-top",
|
|
32
|
+
"max-height",
|
|
33
|
+
"max-width",
|
|
34
|
+
"min-height",
|
|
35
|
+
"min-width",
|
|
36
|
+
"overflow-x",
|
|
37
|
+
"overflow-y",
|
|
38
|
+
"overscroll-behavior-x",
|
|
39
|
+
"overscroll-behavior-y",
|
|
40
|
+
"padding-bottom",
|
|
41
|
+
"padding-top",
|
|
42
|
+
"scroll-margin-bottom",
|
|
43
|
+
"scroll-margin-top",
|
|
44
|
+
"scroll-padding-bottom",
|
|
45
|
+
"scroll-padding-top",
|
|
46
|
+
"top",
|
|
47
|
+
"width"
|
|
48
|
+
];
|
|
49
|
+
function getCSSRules(options) {
|
|
50
|
+
const { css } = options.configs;
|
|
51
|
+
const { useBaseline, allowedRelativeFontUnits } = isEnabled(css) ? css : defaultOptions.configs.css;
|
|
52
|
+
const cssRules = {
|
|
53
|
+
"css/no-invalid-properties": ["error", { allowUnknownVariables: true }],
|
|
54
|
+
"css/relative-font-units": ["warn", { allowUnits: allowedRelativeFontUnits }],
|
|
55
|
+
"css/use-baseline": useBaseline ? ["warn", { available: useBaseline }] : "off",
|
|
56
|
+
"css/prefer-logical-properties": ["error", {
|
|
57
|
+
allowUnits: allowedPhysicalUnits,
|
|
58
|
+
allowProperties: allowedPhysicalProperties
|
|
59
|
+
}]
|
|
60
|
+
};
|
|
61
|
+
return cssRules;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
//#endregion
|
|
65
|
+
export { getCSSRules };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/rules/cypress.ts
|
|
3
|
+
function getCypressRules() {
|
|
4
|
+
const cypressRules = {
|
|
5
|
+
"cypress/no-force": "error",
|
|
6
|
+
"cypress/no-pause": "error",
|
|
7
|
+
"cypress/no-xpath": "error",
|
|
8
|
+
"cypress/no-async-tests": "off",
|
|
9
|
+
"cypress/no-chained-get": "error",
|
|
10
|
+
"cypress/assertion-before-screenshot": "error"
|
|
11
|
+
};
|
|
12
|
+
return cypressRules;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
exports.getCypressRules = getCypressRules;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/rules/cypress.ts
|
|
2
|
+
function getCypressRules() {
|
|
3
|
+
const cypressRules = {
|
|
4
|
+
"cypress/no-force": "error",
|
|
5
|
+
"cypress/no-pause": "error",
|
|
6
|
+
"cypress/no-xpath": "error",
|
|
7
|
+
"cypress/no-async-tests": "off",
|
|
8
|
+
"cypress/no-chained-get": "error",
|
|
9
|
+
"cypress/assertion-before-screenshot": "error"
|
|
10
|
+
};
|
|
11
|
+
return cypressRules;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { getCypressRules };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const require__Users_shayan_Desktop_Dev_GitHub_eslint_config_src_utils_isEnabled = require('../utils/isEnabled.cjs');
|
|
2
|
+
const require__Users_shayan_Desktop_Dev_GitHub_eslint_config_src_utils_options_defaultOptions = require('../utils/options/defaultOptions.cjs');
|
|
3
|
+
|
|
4
|
+
//#region src/rules/html.ts
|
|
5
|
+
function getHTMLRules(options) {
|
|
6
|
+
const { html, stylistic } = options.configs;
|
|
7
|
+
const { useBaseline, idNamingConvention } = require__Users_shayan_Desktop_Dev_GitHub_eslint_config_src_utils_isEnabled.isEnabled(html) ? html : require__Users_shayan_Desktop_Dev_GitHub_eslint_config_src_utils_options_defaultOptions.defaultOptions.configs.html;
|
|
8
|
+
const { indent, useTabs, maxAttributesPerLine, maxConsecutiveEmptyLines, selfCloseVoidHTMLElements } = require__Users_shayan_Desktop_Dev_GitHub_eslint_config_src_utils_isEnabled.isEnabled(stylistic) ? stylistic : require__Users_shayan_Desktop_Dev_GitHub_eslint_config_src_utils_options_defaultOptions.defaultOptions.configs.stylistic;
|
|
9
|
+
const htmlRules = {
|
|
10
|
+
"better-tailwindcss/no-duplicate-classes": "off",
|
|
11
|
+
"@html-eslint/no-target-blank": "error",
|
|
12
|
+
"@html-eslint/no-duplicate-class": "warn",
|
|
13
|
+
"@html-eslint/require-button-type": "error",
|
|
14
|
+
"@html-eslint/no-script-style-type": "error",
|
|
15
|
+
"@html-eslint/require-meta-charset": "error",
|
|
16
|
+
"@html-eslint/quotes": [
|
|
17
|
+
"warn",
|
|
18
|
+
"double",
|
|
19
|
+
{ enforceTemplatedAttrValue: true }
|
|
20
|
+
],
|
|
21
|
+
"@html-eslint/use-baseline": useBaseline ? ["warn", { available: useBaseline }] : "off",
|
|
22
|
+
"@html-eslint/require-closing-tags": ["error", {
|
|
23
|
+
selfClosingCustomPatterns: ["-"],
|
|
24
|
+
selfClosing: selfCloseVoidHTMLElements
|
|
25
|
+
}],
|
|
26
|
+
"@html-eslint/require-meta-description": "error",
|
|
27
|
+
"@html-eslint/require-open-graph-protocol": "error",
|
|
28
|
+
"@html-eslint/no-abstract-roles": "error",
|
|
29
|
+
"@html-eslint/no-accesskey-attrs": "error",
|
|
30
|
+
"@html-eslint/require-frame-title": "error",
|
|
31
|
+
"@html-eslint/no-aria-hidden-body": "error",
|
|
32
|
+
"@html-eslint/no-positive-tabindex": "error",
|
|
33
|
+
"@html-eslint/require-meta-viewport": "error",
|
|
34
|
+
"@html-eslint/no-skip-heading-levels": "error",
|
|
35
|
+
"@html-eslint/lowercase": "warn",
|
|
36
|
+
"@html-eslint/no-trailing-spaces": "warn",
|
|
37
|
+
"@html-eslint/indent": ["warn", useTabs ? "tab" : indent],
|
|
38
|
+
"@html-eslint/id-naming-convention": ["warn", idNamingConvention],
|
|
39
|
+
"@html-eslint/element-newline": ["warn", { inline: ["$inline"] }],
|
|
40
|
+
"@html-eslint/attrs-newline": ["warn", { ifAttrsMoreThan: maxAttributesPerLine }],
|
|
41
|
+
"@html-eslint/no-multiple-empty-lines": ["warn", { max: maxConsecutiveEmptyLines }],
|
|
42
|
+
"@html-eslint/no-extra-spacing-attrs": ["warn", {
|
|
43
|
+
disallowTabs: true,
|
|
44
|
+
disallowMissing: true,
|
|
45
|
+
disallowInAssignment: true,
|
|
46
|
+
enforceBeforeSelfClose: true
|
|
47
|
+
}]
|
|
48
|
+
};
|
|
49
|
+
return htmlRules;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
//#endregion
|
|
53
|
+
exports.getHTMLRules = getHTMLRules;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { isEnabled } from "../utils/isEnabled.js";
|
|
2
|
+
import { defaultOptions } from "../utils/options/defaultOptions.js";
|
|
3
|
+
|
|
4
|
+
//#region src/rules/html.ts
|
|
5
|
+
function getHTMLRules(options) {
|
|
6
|
+
const { html, stylistic } = options.configs;
|
|
7
|
+
const { useBaseline, idNamingConvention } = isEnabled(html) ? html : defaultOptions.configs.html;
|
|
8
|
+
const { indent, useTabs, maxAttributesPerLine, maxConsecutiveEmptyLines, selfCloseVoidHTMLElements } = isEnabled(stylistic) ? stylistic : defaultOptions.configs.stylistic;
|
|
9
|
+
const htmlRules = {
|
|
10
|
+
"better-tailwindcss/no-duplicate-classes": "off",
|
|
11
|
+
"@html-eslint/no-target-blank": "error",
|
|
12
|
+
"@html-eslint/no-duplicate-class": "warn",
|
|
13
|
+
"@html-eslint/require-button-type": "error",
|
|
14
|
+
"@html-eslint/no-script-style-type": "error",
|
|
15
|
+
"@html-eslint/require-meta-charset": "error",
|
|
16
|
+
"@html-eslint/quotes": [
|
|
17
|
+
"warn",
|
|
18
|
+
"double",
|
|
19
|
+
{ enforceTemplatedAttrValue: true }
|
|
20
|
+
],
|
|
21
|
+
"@html-eslint/use-baseline": useBaseline ? ["warn", { available: useBaseline }] : "off",
|
|
22
|
+
"@html-eslint/require-closing-tags": ["error", {
|
|
23
|
+
selfClosingCustomPatterns: ["-"],
|
|
24
|
+
selfClosing: selfCloseVoidHTMLElements
|
|
25
|
+
}],
|
|
26
|
+
"@html-eslint/require-meta-description": "error",
|
|
27
|
+
"@html-eslint/require-open-graph-protocol": "error",
|
|
28
|
+
"@html-eslint/no-abstract-roles": "error",
|
|
29
|
+
"@html-eslint/no-accesskey-attrs": "error",
|
|
30
|
+
"@html-eslint/require-frame-title": "error",
|
|
31
|
+
"@html-eslint/no-aria-hidden-body": "error",
|
|
32
|
+
"@html-eslint/no-positive-tabindex": "error",
|
|
33
|
+
"@html-eslint/require-meta-viewport": "error",
|
|
34
|
+
"@html-eslint/no-skip-heading-levels": "error",
|
|
35
|
+
"@html-eslint/lowercase": "warn",
|
|
36
|
+
"@html-eslint/no-trailing-spaces": "warn",
|
|
37
|
+
"@html-eslint/indent": ["warn", useTabs ? "tab" : indent],
|
|
38
|
+
"@html-eslint/id-naming-convention": ["warn", idNamingConvention],
|
|
39
|
+
"@html-eslint/element-newline": ["warn", { inline: ["$inline"] }],
|
|
40
|
+
"@html-eslint/attrs-newline": ["warn", { ifAttrsMoreThan: maxAttributesPerLine }],
|
|
41
|
+
"@html-eslint/no-multiple-empty-lines": ["warn", { max: maxConsecutiveEmptyLines }],
|
|
42
|
+
"@html-eslint/no-extra-spacing-attrs": ["warn", {
|
|
43
|
+
disallowTabs: true,
|
|
44
|
+
disallowMissing: true,
|
|
45
|
+
disallowInAssignment: true,
|
|
46
|
+
enforceBeforeSelfClose: true
|
|
47
|
+
}]
|
|
48
|
+
};
|
|
49
|
+
return htmlRules;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
//#endregion
|
|
53
|
+
export { getHTMLRules };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require__Users_shayan_Desktop_Dev_GitHub_eslint_config_src_utils_isEnabled = require('../utils/isEnabled.cjs');
|
|
3
|
+
const require__Users_shayan_Desktop_Dev_GitHub_eslint_config_src_utils_options_defaultOptions = require('../utils/options/defaultOptions.cjs');
|
|
4
|
+
const node_path = require_rolldown_runtime.__toESM(require("node:path"));
|
|
5
|
+
|
|
6
|
+
//#region src/rules/importX.ts
|
|
7
|
+
function getImportXRules(options) {
|
|
8
|
+
const { packageDir, configs: { importX } } = options;
|
|
9
|
+
const { requireFileExtension } = require__Users_shayan_Desktop_Dev_GitHub_eslint_config_src_utils_isEnabled.isEnabled(importX) ? importX : require__Users_shayan_Desktop_Dev_GitHub_eslint_config_src_utils_options_defaultOptions.defaultOptions.configs.importX;
|
|
10
|
+
const importXRules = {
|
|
11
|
+
"unused-imports/no-unused-imports": "warn",
|
|
12
|
+
"import-x/no-amd": "error",
|
|
13
|
+
"import-x/exports-last": "warn",
|
|
14
|
+
"import-x/no-commonjs": "error",
|
|
15
|
+
"import-x/no-deprecated": "warn",
|
|
16
|
+
"import-x/group-exports": "warn",
|
|
17
|
+
"import-x/no-self-import": "error",
|
|
18
|
+
"import-x/no-absolute-path": "warn",
|
|
19
|
+
"import-x/no-named-default": "error",
|
|
20
|
+
"import-x/no-mutable-exports": "error",
|
|
21
|
+
"import-x/no-empty-named-blocks": "error",
|
|
22
|
+
"import-x/no-named-as-default-member": "off",
|
|
23
|
+
"import-x/no-import-module-exports": "error",
|
|
24
|
+
"import-x/no-useless-path-segments": "error",
|
|
25
|
+
"import-x/consistent-type-specifier-style": "warn",
|
|
26
|
+
"import-x/first": ["warn", "disable-absolute-first"],
|
|
27
|
+
"import-x/namespace": ["error", { allowComputed: true }],
|
|
28
|
+
"import-x/no-duplicates": ["error", { considerQueryString: true }],
|
|
29
|
+
"import-x/no-cycle": ["error", {
|
|
30
|
+
maxDepth: 1,
|
|
31
|
+
ignoreExternal: true
|
|
32
|
+
}],
|
|
33
|
+
"import-x/no-extraneous-dependencies": ["error", {
|
|
34
|
+
includeTypes: true,
|
|
35
|
+
packageDir: node_path.default.resolve(packageDir)
|
|
36
|
+
}],
|
|
37
|
+
"import-x/extensions": [
|
|
38
|
+
"error",
|
|
39
|
+
requireFileExtension,
|
|
40
|
+
{
|
|
41
|
+
fix: true,
|
|
42
|
+
ignorePackages: true,
|
|
43
|
+
checkTypeImports: true
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
};
|
|
47
|
+
return importXRules;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
//#endregion
|
|
51
|
+
exports.getImportXRules = getImportXRules;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { isEnabled } from "../utils/isEnabled.js";
|
|
2
|
+
import { defaultOptions } from "../utils/options/defaultOptions.js";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
|
|
5
|
+
//#region src/rules/importX.ts
|
|
6
|
+
function getImportXRules(options) {
|
|
7
|
+
const { packageDir, configs: { importX } } = options;
|
|
8
|
+
const { requireFileExtension } = isEnabled(importX) ? importX : defaultOptions.configs.importX;
|
|
9
|
+
const importXRules = {
|
|
10
|
+
"unused-imports/no-unused-imports": "warn",
|
|
11
|
+
"import-x/no-amd": "error",
|
|
12
|
+
"import-x/exports-last": "warn",
|
|
13
|
+
"import-x/no-commonjs": "error",
|
|
14
|
+
"import-x/no-deprecated": "warn",
|
|
15
|
+
"import-x/group-exports": "warn",
|
|
16
|
+
"import-x/no-self-import": "error",
|
|
17
|
+
"import-x/no-absolute-path": "warn",
|
|
18
|
+
"import-x/no-named-default": "error",
|
|
19
|
+
"import-x/no-mutable-exports": "error",
|
|
20
|
+
"import-x/no-empty-named-blocks": "error",
|
|
21
|
+
"import-x/no-named-as-default-member": "off",
|
|
22
|
+
"import-x/no-import-module-exports": "error",
|
|
23
|
+
"import-x/no-useless-path-segments": "error",
|
|
24
|
+
"import-x/consistent-type-specifier-style": "warn",
|
|
25
|
+
"import-x/first": ["warn", "disable-absolute-first"],
|
|
26
|
+
"import-x/namespace": ["error", { allowComputed: true }],
|
|
27
|
+
"import-x/no-duplicates": ["error", { considerQueryString: true }],
|
|
28
|
+
"import-x/no-cycle": ["error", {
|
|
29
|
+
maxDepth: 1,
|
|
30
|
+
ignoreExternal: true
|
|
31
|
+
}],
|
|
32
|
+
"import-x/no-extraneous-dependencies": ["error", {
|
|
33
|
+
includeTypes: true,
|
|
34
|
+
packageDir: path.resolve(packageDir)
|
|
35
|
+
}],
|
|
36
|
+
"import-x/extensions": [
|
|
37
|
+
"error",
|
|
38
|
+
requireFileExtension,
|
|
39
|
+
{
|
|
40
|
+
fix: true,
|
|
41
|
+
ignorePackages: true,
|
|
42
|
+
checkTypeImports: true
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
};
|
|
46
|
+
return importXRules;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
//#endregion
|
|
50
|
+
export { getImportXRules };
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/rules/javascript.ts
|
|
3
|
+
function getJavaScriptRules(options) {
|
|
4
|
+
const { maxDepth, functionStyle, maxNestedCallbacks, preferNamedExports } = options.configs.base;
|
|
5
|
+
const javascriptRules = {
|
|
6
|
+
"no-self-compare": "warn",
|
|
7
|
+
"no-await-in-loop": "error",
|
|
8
|
+
"no-unassigned-vars": "error",
|
|
9
|
+
"no-unreachable-loop": "warn",
|
|
10
|
+
"no-inner-declarations": "warn",
|
|
11
|
+
"require-atomic-updates": "warn",
|
|
12
|
+
"array-callback-return": "error",
|
|
13
|
+
"no-useless-assignment": "error",
|
|
14
|
+
"no-constructor-return": "error",
|
|
15
|
+
"no-async-promise-executor": "error",
|
|
16
|
+
"no-promise-executor-return": "error",
|
|
17
|
+
"no-template-curly-in-string": "error",
|
|
18
|
+
"no-unmodified-loop-condition": "error",
|
|
19
|
+
"use-isnan": ["error", { enforceForIndexOf: true }],
|
|
20
|
+
"no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
|
|
21
|
+
"no-unsafe-negation": ["error", { enforceForOrderingRelations: true }],
|
|
22
|
+
"no-unsafe-optional-chaining": ["error", { disallowArithmeticOperators: true }],
|
|
23
|
+
"no-use-before-define": ["error", {
|
|
24
|
+
functions: false,
|
|
25
|
+
ignoreTypeReferences: false
|
|
26
|
+
}],
|
|
27
|
+
"no-duplicate-imports": ["error", {
|
|
28
|
+
includeExports: true,
|
|
29
|
+
allowSeparateTypeImports: true
|
|
30
|
+
}],
|
|
31
|
+
"yoda": "warn",
|
|
32
|
+
"strict": "error",
|
|
33
|
+
"no-var": "error",
|
|
34
|
+
"eqeqeq": "error",
|
|
35
|
+
"no-new": "error",
|
|
36
|
+
"new-cap": "warn",
|
|
37
|
+
"no-eval": "error",
|
|
38
|
+
"no-void": "error",
|
|
39
|
+
"no-proto": "warn",
|
|
40
|
+
"no-empty": "warn",
|
|
41
|
+
"camelcase": "warn",
|
|
42
|
+
"no-caller": "error",
|
|
43
|
+
"no-eq-null": "warn",
|
|
44
|
+
"complexity": "warn",
|
|
45
|
+
"sort-imports": "off",
|
|
46
|
+
"no-redeclare": "off",
|
|
47
|
+
"no-iterator": "warn",
|
|
48
|
+
"no-continue": "warn",
|
|
49
|
+
"no-new-func": "error",
|
|
50
|
+
"guard-for-in": "warn",
|
|
51
|
+
"no-loop-func": "warn",
|
|
52
|
+
"default-case": "warn",
|
|
53
|
+
"no-lonely-if": "error",
|
|
54
|
+
"no-label-var": "error",
|
|
55
|
+
"no-multi-str": "error",
|
|
56
|
+
"prefer-const": "error",
|
|
57
|
+
"require-await": "warn",
|
|
58
|
+
"dot-notation": "error",
|
|
59
|
+
"no-script-url": "error",
|
|
60
|
+
"no-undef-init": "error",
|
|
61
|
+
"no-extra-bind": "error",
|
|
62
|
+
"prefer-spread": "error",
|
|
63
|
+
"no-lone-blocks": "error",
|
|
64
|
+
"no-extra-label": "error",
|
|
65
|
+
"accessor-pairs": "error",
|
|
66
|
+
"prefer-template": "warn",
|
|
67
|
+
"no-invalid-this": "error",
|
|
68
|
+
"no-useless-call": "error",
|
|
69
|
+
"no-implied-eval": "error",
|
|
70
|
+
"consistent-this": "error",
|
|
71
|
+
"no-octal-escape": "error",
|
|
72
|
+
"no-new-wrappers": "error",
|
|
73
|
+
"block-scoped-var": "warn",
|
|
74
|
+
"object-shorthand": "warn",
|
|
75
|
+
"no-throw-literal": "error",
|
|
76
|
+
"no-extend-native": "error",
|
|
77
|
+
"default-case-last": "warn",
|
|
78
|
+
"no-nested-ternary": "warn",
|
|
79
|
+
"no-useless-return": "error",
|
|
80
|
+
"init-declarations": "error",
|
|
81
|
+
"consistent-return": "error",
|
|
82
|
+
"no-useless-concat": "error",
|
|
83
|
+
"no-useless-rename": "error",
|
|
84
|
+
"default-param-last": "warn",
|
|
85
|
+
"symbol-description": "warn",
|
|
86
|
+
"func-name-matching": "warn",
|
|
87
|
+
"prefer-rest-params": "error",
|
|
88
|
+
"operator-assignment": "error",
|
|
89
|
+
"no-unneeded-ternary": "error",
|
|
90
|
+
"no-implicit-globals": "error",
|
|
91
|
+
"prefer-destructuring": "warn",
|
|
92
|
+
"no-implicit-coercion": "error",
|
|
93
|
+
"no-array-constructor": "error",
|
|
94
|
+
"no-underscore-dangle": "error",
|
|
95
|
+
"prefer-object-spread": "error",
|
|
96
|
+
"radix": ["error", "as-needed"],
|
|
97
|
+
"curly": ["warn", "multi-line"],
|
|
98
|
+
"max-depth": ["warn", maxDepth],
|
|
99
|
+
"no-object-constructor": "error",
|
|
100
|
+
"prefer-object-has-own": "error",
|
|
101
|
+
"no-useless-constructor": "error",
|
|
102
|
+
"class-methods-use-this": "error",
|
|
103
|
+
"prefer-numeric-literals": "error",
|
|
104
|
+
"no-useless-computed-key": "error",
|
|
105
|
+
"prefer-named-capture-group": "warn",
|
|
106
|
+
"no-return-assign": ["error", "always"],
|
|
107
|
+
"prefer-exponentiation-operator": "error",
|
|
108
|
+
"no-bitwise": ["error", { int32Hint: true }],
|
|
109
|
+
"max-params": ["warn", { countVoidThis: true }],
|
|
110
|
+
"logical-assignment-operators": ["error", "always"],
|
|
111
|
+
"max-nested-callbacks": ["warn", maxNestedCallbacks],
|
|
112
|
+
"no-sequences": ["error", { allowInParentheses: false }],
|
|
113
|
+
"no-multi-assign": ["error", { ignoreNonDeclaration: true }],
|
|
114
|
+
"no-plusplus": ["error", { allowForLoopAfterthoughts: true }],
|
|
115
|
+
"prefer-arrow-callback": ["error", { allowUnboundThis: true }],
|
|
116
|
+
"no-shadow-restricted-names": ["warn", { reportGlobalThis: true }],
|
|
117
|
+
"func-style": [
|
|
118
|
+
"warn",
|
|
119
|
+
functionStyle,
|
|
120
|
+
{ allowTypeAnnotation: true }
|
|
121
|
+
],
|
|
122
|
+
"prefer-promise-reject-errors": ["error", { allowEmptyReject: true }],
|
|
123
|
+
"prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
|
|
124
|
+
"no-extra-boolean-cast": ["error", { enforceForInnerExpressions: true }],
|
|
125
|
+
"no-console": ["warn", { allow: [
|
|
126
|
+
"info",
|
|
127
|
+
"warn",
|
|
128
|
+
"error",
|
|
129
|
+
"table",
|
|
130
|
+
"group",
|
|
131
|
+
"groupEnd",
|
|
132
|
+
"groupCollapsed"
|
|
133
|
+
] }],
|
|
134
|
+
"no-shadow": ["error", {
|
|
135
|
+
hoist: "all",
|
|
136
|
+
allow: ["name"],
|
|
137
|
+
builtinGlobals: true,
|
|
138
|
+
ignoreTypeValueShadow: false,
|
|
139
|
+
ignoreFunctionTypeParameterNameValueShadow: false
|
|
140
|
+
}],
|
|
141
|
+
"no-restricted-exports": [preferNamedExports ? "error" : "off", { restrictDefaultExports: {
|
|
142
|
+
named: true,
|
|
143
|
+
namedFrom: true,
|
|
144
|
+
defaultFrom: true,
|
|
145
|
+
namespaceFrom: true
|
|
146
|
+
} }],
|
|
147
|
+
"no-empty-function": ["error", { allow: [
|
|
148
|
+
"overrideMethods",
|
|
149
|
+
"decoratedFunctions",
|
|
150
|
+
"privateConstructors",
|
|
151
|
+
"protectedConstructors"
|
|
152
|
+
] }],
|
|
153
|
+
"no-unused-expressions": ["error", {
|
|
154
|
+
allowTernary: true,
|
|
155
|
+
enforceForJSX: true,
|
|
156
|
+
allowShortCircuit: true,
|
|
157
|
+
allowTaggedTemplates: true
|
|
158
|
+
}]
|
|
159
|
+
};
|
|
160
|
+
return javascriptRules;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
//#endregion
|
|
164
|
+
exports.getJavaScriptRules = getJavaScriptRules;
|