@shayanthenerd/eslint-config 0.14.0 → 0.15.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 +1 -1
- package/README.md +187 -178
- package/dist/configs/base.mjs +13 -9
- package/dist/configs/css.mjs +2 -2
- package/dist/configs/cypress.mjs +2 -2
- package/dist/configs/html.mjs +2 -2
- package/dist/configs/importX.mjs +2 -2
- package/dist/configs/oxlintOverrides.mjs +16 -11
- package/dist/configs/perfectionist.mjs +2 -2
- package/dist/configs/playwright.mjs +2 -2
- package/dist/configs/restrictedExports.mjs +1 -1
- package/dist/configs/storybook.mjs +2 -2
- package/dist/configs/stylistic.mjs +2 -2
- package/dist/configs/tailwind.mjs +4 -4
- package/dist/configs/typescript.mjs +2 -2
- package/dist/configs/vitest.mjs +2 -2
- package/dist/configs/vue.mjs +2 -2
- package/dist/configs/vueComponentNames.mjs +1 -1
- package/dist/configs/vueServerComponents.mjs +1 -1
- package/dist/configs/zod.mjs +2 -2
- package/dist/{utils → helpers}/globs.mjs +1 -1
- package/dist/{utils → helpers}/ignores/defaultIgnorePatterns.mjs +1 -1
- package/dist/{utils → helpers}/ignores/getIgnorePatterns.mjs +1 -1
- package/dist/{utils → helpers}/ignores/resolveGitignorePatterns.mjs +1 -1
- package/dist/{utils → helpers}/isPackageDetected.mjs +1 -1
- package/dist/{utils → helpers}/options/defaultOptions.mjs +13 -7
- package/dist/{utils → helpers}/options/enableDetectedConfigs.mjs +1 -3
- package/dist/{utils → helpers}/options/mergeWithDefaults.mjs +4 -5
- package/dist/{utils → helpers}/vue/getRestrictedVueElements.mjs +1 -1
- package/dist/{utils → helpers}/vue/getRestrictedVueInputs.mjs +1 -1
- package/dist/index.mjs +3 -3
- package/dist/oxlint.config.jsonc +209 -206
- package/dist/prettier.config.mjs +1 -1
- package/dist/rules/css.mjs +1 -1
- package/dist/rules/html.mjs +3 -3
- package/dist/rules/importX.mjs +1 -1
- package/dist/rules/javascript.mjs +1 -2
- package/dist/rules/perfectionist.mjs +2 -2
- package/dist/rules/stylistic.mjs +10 -7
- package/dist/rules/tailwind.mjs +4 -4
- package/dist/rules/typescript.mjs +2 -2
- package/dist/rules/vue.mjs +6 -6
- package/dist/rules/vueAccessibility.mjs +1 -1
- package/dist/types/configOptions/base.d.mts +8 -8
- package/dist/types/configOptions/nuxt.d.mts +3 -3
- package/dist/types/configOptions/stylistic.d.mts +0 -15
- package/dist/types/configOptions/test.d.mts +4 -4
- package/dist/types/configOptions/vue.d.mts +1 -1
- package/dist/types/eslint-schema.d.mts +549 -201
- package/dist/types/index.d.mts +36 -19
- package/package.json +139 -124
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { globs } from "../
|
|
1
|
+
import { globs } from "../helpers/globs.mjs";
|
|
2
2
|
import { isEnabled } from "../utils/isEnabled.mjs";
|
|
3
|
-
import { defaultOptions } from "../
|
|
3
|
+
import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
|
|
4
4
|
import { getTailwindRules } from "../rules/tailwind.mjs";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { mergeConfigs } from "eslint-flat-config-utils";
|
|
@@ -25,8 +25,8 @@ function getTailwindConfig(options) {
|
|
|
25
25
|
name: "shayanthenerd/tailwind",
|
|
26
26
|
files: [
|
|
27
27
|
globs.src,
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
vue ? globs.vue : "",
|
|
29
|
+
html ? globs.html : ""
|
|
30
30
|
].filter(Boolean),
|
|
31
31
|
plugins: { "better-tailwindcss": eslintPluginTailwind },
|
|
32
32
|
languageOptions: { parserOptions: { parser: isEnabled(html) ? eslintParserHTML : eslintParserVue } },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { globs } from "../
|
|
1
|
+
import { globs } from "../helpers/globs.mjs";
|
|
2
2
|
import { isEnabled } from "../utils/isEnabled.mjs";
|
|
3
|
-
import { defaultOptions } from "../
|
|
3
|
+
import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
|
|
4
4
|
import { getTypeScriptRules } from "../rules/typescript.mjs";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { mergeConfigs } from "eslint-flat-config-utils";
|
package/dist/configs/vitest.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { globs } from "../
|
|
1
|
+
import { globs } from "../helpers/globs.mjs";
|
|
2
2
|
import { isEnabled } from "../utils/isEnabled.mjs";
|
|
3
|
-
import { defaultOptions } from "../
|
|
3
|
+
import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
|
|
4
4
|
import { getVitestRules } from "../rules/vitest.mjs";
|
|
5
5
|
import { mergeConfigs } from "eslint-flat-config-utils";
|
|
6
6
|
import eslintPluginVitest from "@vitest/eslint-plugin";
|
package/dist/configs/vue.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { globs } from "../
|
|
1
|
+
import { globs } from "../helpers/globs.mjs";
|
|
2
2
|
import { isEnabled } from "../utils/isEnabled.mjs";
|
|
3
|
-
import { defaultOptions } from "../
|
|
3
|
+
import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
|
|
4
4
|
import { getVueRules } from "../rules/vue.mjs";
|
|
5
5
|
import { getVueAccessibilityRules } from "../rules/vueAccessibility.mjs";
|
|
6
6
|
import { mergeConfigs } from "eslint-flat-config-utils";
|
package/dist/configs/zod.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { globs } from "../
|
|
1
|
+
import { globs } from "../helpers/globs.mjs";
|
|
2
2
|
import { isEnabled } from "../utils/isEnabled.mjs";
|
|
3
|
-
import { defaultOptions } from "../
|
|
3
|
+
import { defaultOptions } from "../helpers/options/defaultOptions.mjs";
|
|
4
4
|
import { getZodRules } from "../rules/zod.mjs";
|
|
5
5
|
import { mergeConfigs } from "eslint-flat-config-utils";
|
|
6
6
|
import eslintPluginZodX from "eslint-plugin-zod-x";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defaultIgnorePatterns } from "./defaultIgnorePatterns.mjs";
|
|
2
2
|
import { resolveGitignorePatterns } from "./resolveGitignorePatterns.mjs";
|
|
3
3
|
|
|
4
|
-
//#region src/
|
|
4
|
+
//#region src/helpers/ignores/getIgnorePatterns.ts
|
|
5
5
|
function getIgnorePatterns({ patterns, gitignore }) {
|
|
6
6
|
if (gitignore) {
|
|
7
7
|
const gitignorePatterns = resolveGitignorePatterns(gitignore);
|
|
@@ -3,7 +3,7 @@ import { includeIgnoreFile } from "@eslint/compat";
|
|
|
3
3
|
import fs from "node:fs";
|
|
4
4
|
import { styleText } from "node:util";
|
|
5
5
|
|
|
6
|
-
//#region src/
|
|
6
|
+
//#region src/helpers/ignores/resolveGitignorePatterns.ts
|
|
7
7
|
const warningMessage = styleText("yellow", "⚠ Warning:");
|
|
8
8
|
const fallbackMessage = `Falling back to default ignore patterns. You can suppress this warning by setting ${styleText("bgBlack", " gitignore: false ")} in the config.`;
|
|
9
9
|
function resolveGitignorePatterns(gitignorePath) {
|
|
@@ -3,7 +3,7 @@ import path from "node:path";
|
|
|
3
3
|
import { styleText } from "node:util";
|
|
4
4
|
import { isPackageExists } from "local-pkg";
|
|
5
5
|
|
|
6
|
-
//#region src/
|
|
6
|
+
//#region src/helpers/isPackageDetected.ts
|
|
7
7
|
const detectedPackages = [];
|
|
8
8
|
function logDetectedPackages() {
|
|
9
9
|
if (detectedPackages.length > 0) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region src/
|
|
1
|
+
//#region src/helpers/options/defaultOptions.ts
|
|
2
2
|
const defaultOptions = {
|
|
3
3
|
autoDetectDeps: true,
|
|
4
4
|
gitignore: ".gitignore",
|
|
@@ -14,19 +14,26 @@ const defaultOptions = {
|
|
|
14
14
|
reportUnusedDisableDirectives: "warn"
|
|
15
15
|
},
|
|
16
16
|
globals: {
|
|
17
|
-
|
|
17
|
+
worker: true,
|
|
18
18
|
commonjs: false,
|
|
19
|
+
bun: true,
|
|
20
|
+
deno: true,
|
|
21
|
+
node: true,
|
|
22
|
+
nodeBuiltin: true,
|
|
19
23
|
browser: true,
|
|
20
|
-
|
|
21
|
-
serviceworker:
|
|
22
|
-
webextension:
|
|
24
|
+
sharedWorker: true,
|
|
25
|
+
serviceworker: true,
|
|
26
|
+
webextension: true,
|
|
27
|
+
audioWorklet: true,
|
|
28
|
+
vitest: false,
|
|
29
|
+
vue: true,
|
|
23
30
|
custom: {}
|
|
24
31
|
},
|
|
25
32
|
settings: {},
|
|
26
33
|
rules: {}
|
|
27
34
|
},
|
|
28
35
|
configs: {
|
|
29
|
-
oxlint: "
|
|
36
|
+
oxlint: ".oxlintrc.json",
|
|
30
37
|
base: {
|
|
31
38
|
maxDepth: 3,
|
|
32
39
|
maxNestedCallbacks: 3,
|
|
@@ -41,7 +48,6 @@ const defaultOptions = {
|
|
|
41
48
|
quotes: "single",
|
|
42
49
|
jsxQuotes: "prefer-double",
|
|
43
50
|
arrowParens: "always",
|
|
44
|
-
useTabs: true,
|
|
45
51
|
indent: 2,
|
|
46
52
|
maxConsecutiveEmptyLines: 1,
|
|
47
53
|
maxLineLength: 120,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { defaultOptions } from "./defaultOptions.mjs";
|
|
2
1
|
import { isPackageDetected, logDetectedPackages } from "../isPackageDetected.mjs";
|
|
3
2
|
|
|
4
|
-
//#region src/
|
|
3
|
+
//#region src/helpers/options/enableDetectedConfigs.ts
|
|
5
4
|
function enableDetectedConfigs(options) {
|
|
6
5
|
options.configs ??= {};
|
|
7
6
|
options.configs.test ??= {};
|
|
@@ -19,7 +18,6 @@ function enableDetectedConfigs(options) {
|
|
|
19
18
|
options.configs.test.cypress ??= isPackageDetected("cypress", options);
|
|
20
19
|
options.configs.test.storybook ??= isPackageDetected("storybook", options);
|
|
21
20
|
options.configs.test.playwright ??= isPackageDetected("@playwright/test", options);
|
|
22
|
-
options.configs.oxlint ??= isPackageDetected("oxlint", options) ? defaultOptions.configs.oxlint : false;
|
|
23
21
|
options.tsConfig ??= options.configs.typescript ? {
|
|
24
22
|
rootDir: ".",
|
|
25
23
|
filename: "tsconfig.json"
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { defaultOptions } from "./defaultOptions.mjs";
|
|
2
|
-
import { isEmptyString } from "
|
|
2
|
+
import { isEmptyString } from "../../utils/isEmptyString.mjs";
|
|
3
3
|
import { enableDetectedConfigs } from "./enableDetectedConfigs.mjs";
|
|
4
4
|
import { createDefu } from "defu";
|
|
5
5
|
|
|
6
|
-
//#region src/
|
|
6
|
+
//#region src/helpers/options/mergeWithDefaults.ts
|
|
7
7
|
const mergeOptions = createDefu((object, key, value) => {
|
|
8
|
-
const stringKey = key.toString();
|
|
9
8
|
if ([
|
|
10
9
|
"allowedRelativeFontUnits",
|
|
11
|
-
"macrosOrder",
|
|
12
10
|
"blocksOrder",
|
|
11
|
+
"macrosOrder",
|
|
13
12
|
"attributesOrder"
|
|
14
|
-
].includes(
|
|
13
|
+
].includes(key.toString())) {
|
|
15
14
|
object[key] = value;
|
|
16
15
|
return true;
|
|
17
16
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isEnabled } from "./utils/isEnabled.mjs";
|
|
2
|
-
import { defaultOptions } from "./
|
|
2
|
+
import { defaultOptions } from "./helpers/options/defaultOptions.mjs";
|
|
3
3
|
import { getCSSConfig } from "./configs/css.mjs";
|
|
4
4
|
import { getVueConfig } from "./configs/vue.mjs";
|
|
5
5
|
import { getZodConfig } from "./configs/zod.mjs";
|
|
@@ -16,8 +16,8 @@ import { getTypeScriptConfig } from "./configs/typescript.mjs";
|
|
|
16
16
|
import { getPerfectionistConfig } from "./configs/perfectionist.mjs";
|
|
17
17
|
import { getRestrictedExports } from "./configs/restrictedExports.mjs";
|
|
18
18
|
import { getOXLintOverridesConfig } from "./configs/oxlintOverrides.mjs";
|
|
19
|
-
import { getIgnorePatterns } from "./
|
|
20
|
-
import { mergeWithDefaults } from "./
|
|
19
|
+
import { getIgnorePatterns } from "./helpers/ignores/getIgnorePatterns.mjs";
|
|
20
|
+
import { mergeWithDefaults } from "./helpers/options/mergeWithDefaults.mjs";
|
|
21
21
|
import { getVueComponentNamesConfig } from "./configs/vueComponentNames.mjs";
|
|
22
22
|
import { getVueServerComponentsConfig } from "./configs/vueServerComponents.mjs";
|
|
23
23
|
import eslintPluginOXLint from "eslint-plugin-oxlint";
|