@shayanthenerd/eslint-config 0.28.1 → 0.28.2
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 +3 -3
- package/dist/configs/importX.mjs +1 -1
- package/dist/configs/node.mjs +2 -2
- package/dist/configs/tailwind.mjs +2 -2
- package/dist/helpers/options/defaultOptions.mjs +1 -0
- package/dist/helpers/options/enableDetectedConfigs.mjs +15 -5
- package/dist/index.mjs +2 -2
- package/dist/rules/perfectionist.mjs +1 -1
- package/dist/rules/vue.mjs +2 -1
- package/dist/types/index.d.mts +7 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -80,7 +80,7 @@ Legend:
|
|
|
80
80
|
{
|
|
81
81
|
"scripts": {
|
|
82
82
|
"lint:inspect": "npx @eslint/config-inspector",
|
|
83
|
-
"lint": "eslint --fix --cache --cache-location='node_modules/.cache/.eslintcache'"
|
|
83
|
+
"lint": "eslint --fix --max-warnings=0 --cache --cache-location='node_modules/.cache/.eslintcache'"
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
```
|
|
@@ -363,7 +363,7 @@ _package.json_:
|
|
|
363
363
|
{
|
|
364
364
|
"scripts": {
|
|
365
365
|
"format": "prettier --write . --cache",
|
|
366
|
-
"lint": "eslint --fix --cache --cache-location='node_modules/.cache/.eslintcache'"
|
|
366
|
+
"lint": "eslint --fix --max-warnings=0 --cache --cache-location='node_modules/.cache/.eslintcache'"
|
|
367
367
|
}
|
|
368
368
|
}
|
|
369
369
|
```
|
|
@@ -427,7 +427,7 @@ _.vscode/settings.json_:
|
|
|
427
427
|
packageDir?: string,
|
|
428
428
|
tsConfig?: false | {
|
|
429
429
|
filename?: string,
|
|
430
|
-
rootDir
|
|
430
|
+
rootDir?: string,
|
|
431
431
|
},
|
|
432
432
|
|
|
433
433
|
project?: {
|
package/dist/configs/importX.mjs
CHANGED
|
@@ -18,7 +18,7 @@ function getImportXConfig(options) {
|
|
|
18
18
|
isEnabled(astro) ? globs.astro : ""
|
|
19
19
|
].filter(isTruthy),
|
|
20
20
|
plugins: { "import-x": eslintPluginImportX },
|
|
21
|
-
settings: isEnabled(typescript) ? eslintPluginImportX.flatConfigs.typescript.settings :
|
|
21
|
+
settings: isEnabled(typescript) ? eslintPluginImportX.flatConfigs.typescript.settings : {},
|
|
22
22
|
rules: getImportXRules(options)
|
|
23
23
|
}, overrides);
|
|
24
24
|
}
|
package/dist/configs/node.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import path from "node:path";
|
|
|
10
10
|
function getNodeConfig(options) {
|
|
11
11
|
const { tsConfig, configs: { vue, node, astro } } = options;
|
|
12
12
|
const { overrides } = isEnabled(node) ? node : defaultOptions.configs.node;
|
|
13
|
-
const
|
|
13
|
+
const tsconfigPath = tsConfig ? path.resolve(tsConfig.rootDir, tsConfig.filename) : void 0;
|
|
14
14
|
return mergeConfigs({
|
|
15
15
|
name: "shayanthenerd/node",
|
|
16
16
|
files: [
|
|
@@ -20,7 +20,7 @@ function getNodeConfig(options) {
|
|
|
20
20
|
isEnabled(astro) ? globs.astro : ""
|
|
21
21
|
].filter(isTruthy),
|
|
22
22
|
plugins: { n: eslintPluginNode },
|
|
23
|
-
settings: { n: { tsconfigPath:
|
|
23
|
+
settings: { n: tsconfigPath ? { tsconfigPath } : void 0 },
|
|
24
24
|
rules: getNodeRules(options)
|
|
25
25
|
}, overrides);
|
|
26
26
|
}
|
|
@@ -45,7 +45,7 @@ const nuxtUiAppConfigUiFields = {
|
|
|
45
45
|
function getTailwindConfig(options) {
|
|
46
46
|
const { tsConfig, configs: { vue, nuxt, html, astro, tailwind } } = options;
|
|
47
47
|
const { cwd, config, overrides, entryPoint } = isEnabled(tailwind) ? tailwind : defaultOptions.configs.tailwind;
|
|
48
|
-
const
|
|
48
|
+
const tsconfigPath = tsConfig ? path.resolve(tsConfig.rootDir, tsConfig.filename) : void 0;
|
|
49
49
|
const isNuxtUiEnabled = isEnabled(nuxt) && isEnabled(nuxt.ui);
|
|
50
50
|
const selectors = [
|
|
51
51
|
...getDefaultSelectors(),
|
|
@@ -66,10 +66,10 @@ function getTailwindConfig(options) {
|
|
|
66
66
|
plugins: { "better-tailwindcss": eslintPluginTailwind },
|
|
67
67
|
settings: { "better-tailwindcss": {
|
|
68
68
|
cwd,
|
|
69
|
-
tsconfig,
|
|
70
69
|
selectors,
|
|
71
70
|
entryPoint,
|
|
72
71
|
tailwindConfig: config,
|
|
72
|
+
tsconfig: tsconfigPath,
|
|
73
73
|
detectComponentClasses: true
|
|
74
74
|
} },
|
|
75
75
|
rules: getTailwindRules(options)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isEnabled } from "../../utils/isEnabled.mjs";
|
|
2
|
+
import { defaultOptions } from "./defaultOptions.mjs";
|
|
2
3
|
import { isPackageDetected, logDetectedPackages } from "../isPackageDetected.mjs";
|
|
3
4
|
//#region src/helpers/options/enableDetectedConfigs.ts
|
|
4
5
|
function enableDetectedConfigs(options) {
|
|
@@ -58,11 +59,20 @@ function enableDetectedConfigs(options) {
|
|
|
58
59
|
options.configs.test.cypress ??= autoDetectedPackages.cypress;
|
|
59
60
|
options.configs.test.storybook ??= autoDetectedPackages.storybook;
|
|
60
61
|
options.configs.test.playwright ??= autoDetectedPackages.playwright;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
const isTypeScriptEnabled = isEnabled(options.configs.typescript);
|
|
63
|
+
if (isTypeScriptEnabled) {
|
|
64
|
+
const defaultTsConfigRootDir = options.packageDir ?? defaultOptions.packageDir;
|
|
65
|
+
const defaultTsConfigFilename = "tsconfig.json";
|
|
66
|
+
if (options.tsConfig === void 0) options.tsConfig = {
|
|
67
|
+
rootDir: defaultTsConfigRootDir,
|
|
68
|
+
filename: defaultTsConfigFilename
|
|
69
|
+
};
|
|
70
|
+
else if (options.tsConfig !== false) {
|
|
71
|
+
options.tsConfig.rootDir ??= defaultTsConfigRootDir;
|
|
72
|
+
options.tsConfig.filename ??= defaultTsConfigFilename;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (isTypeScriptEnabled && options.configs.vue) {
|
|
66
76
|
options.configs.vue = options.configs.vue === true ? {} : options.configs.vue;
|
|
67
77
|
options.configs.vue.blockLang = { script: "ts" };
|
|
68
78
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -82,9 +82,9 @@ function defineConfig(...args) {
|
|
|
82
82
|
return defineConfig$1([
|
|
83
83
|
{
|
|
84
84
|
name: "shayanthenerd/project",
|
|
85
|
-
rules,
|
|
86
85
|
linterOptions,
|
|
87
|
-
|
|
86
|
+
settings,
|
|
87
|
+
rules
|
|
88
88
|
},
|
|
89
89
|
globalIgnores(ignorePatterns, "shayanthenerd/ignores"),
|
|
90
90
|
getBaseConfig(mergedOptions),
|
|
@@ -114,7 +114,7 @@ function getPerfectionistRules(options) {
|
|
|
114
114
|
"perfectionist/sort-named-exports": "warn",
|
|
115
115
|
"perfectionist/sort-imports": ["warn", {
|
|
116
116
|
environment: env === "bun" ? "bun" : "node",
|
|
117
|
-
tsconfig: tsConfig ||
|
|
117
|
+
tsconfig: tsConfig || { rootDir: "" },
|
|
118
118
|
sortSideEffects: true,
|
|
119
119
|
fallbackSort: {
|
|
120
120
|
order: "asc",
|
package/dist/rules/vue.mjs
CHANGED
|
@@ -56,11 +56,12 @@ function getVueRules(options) {
|
|
|
56
56
|
"vuejs-accessibility/tabindex-no-positive": "error"
|
|
57
57
|
};
|
|
58
58
|
const vueAndNuxtRules = {
|
|
59
|
+
"@typescript-eslint/no-useless-default-assignment": "off",
|
|
59
60
|
"vue/jsx-uses-vars": "error",
|
|
60
61
|
"vue/comment-directive": ["error", { reportUnusedDisableDirectives: true }],
|
|
61
62
|
"vue/multi-word-component-names": "error",
|
|
62
63
|
"vue/no-arrow-functions-in-watch": "warn",
|
|
63
|
-
"vue/no-async-in-computed-properties": ["error", { ignoredObjectNames: ["z"] }],
|
|
64
|
+
"vue/no-async-in-computed-properties": ["error", { ignoredObjectNames: ["z", "zod"] }],
|
|
64
65
|
"vue/no-child-content": "error",
|
|
65
66
|
"vue/no-computed-properties-in-data": "error",
|
|
66
67
|
"vue/no-deprecated-data-object-declaration": "error",
|
package/dist/types/index.d.mts
CHANGED
|
@@ -81,25 +81,25 @@ interface Options {
|
|
|
81
81
|
* - [better-tailwindcss: `tsconfig` option](https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/settings/settings.md#tsconfig)
|
|
82
82
|
* - [perfectionist/sort-imports: `tsconfig` option](https://perfectionist.dev/rules/sort-imports#tsconfig)
|
|
83
83
|
*
|
|
84
|
-
* @default
|
|
84
|
+
* @default false // `{ rootDir: options.packageDir ?? '.', filename: 'tsconfig.json' }` if TypeScript integration is enabled
|
|
85
85
|
*/
|
|
86
86
|
tsConfig?: false | {
|
|
87
87
|
/**
|
|
88
|
-
* The
|
|
88
|
+
* The directory of the root TypeScript config file.
|
|
89
89
|
*
|
|
90
90
|
* It will fall back to the default value if set to an empty string (`''`).
|
|
91
91
|
*
|
|
92
|
-
* @default '
|
|
92
|
+
* @default options.packageDir ?? '.'
|
|
93
93
|
*/
|
|
94
|
-
|
|
94
|
+
rootDir?: string;
|
|
95
95
|
/**
|
|
96
|
-
* The
|
|
96
|
+
* The name of the root TypeScript config file.
|
|
97
97
|
*
|
|
98
98
|
* It will fall back to the default value if set to an empty string (`''`).
|
|
99
99
|
*
|
|
100
|
-
* @default '.'
|
|
100
|
+
* @default 'tsconfig.json'
|
|
101
101
|
*/
|
|
102
|
-
|
|
102
|
+
filename?: string;
|
|
103
103
|
};
|
|
104
104
|
/*** Project ***/
|
|
105
105
|
/**
|
package/package.json
CHANGED