@oliver139/eslint-config 7.0.2 → 7.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/README.md +17 -2
- package/dist/index.d.mts +22 -2
- package/dist/index.mjs +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
# Oliver's ESLint Config
|
|
2
2
|
|
|
3
|
+
[](https://npmjs.com/package/@oliver139/eslint-config)
|
|
4
|
+
|
|
3
5
|
My options of [@antfu/eslint-config](https://github.com/antfu/eslint-config).
|
|
4
6
|
|
|
5
7
|
The 3rd version of my eslint config preset, which uses overrides to customize instead, so to simplify each time updating it.
|
|
6
8
|
|
|
7
|
-
[
|
|
9
|
+
Tailwind linting is supported using [`eslint-plugin-better-tailwindcss`](https://github.com/schoero/eslint-plugin-better-tailwindcss)
|
|
8
10
|
|
|
9
11
|
## Install
|
|
10
12
|
|
|
@@ -18,5 +20,18 @@ npm install -D eslint @oliver139/eslint-config@7 @antfu/eslint-config
|
|
|
18
20
|
import antfu from '@antfu/eslint-config'
|
|
19
21
|
import { options } from '@oliver139/eslint-config'
|
|
20
22
|
|
|
21
|
-
export default antfu(...options(
|
|
23
|
+
export default antfu(...options({
|
|
24
|
+
tailwind: {
|
|
25
|
+
// tailwindcss 4: the path to the entry file of the css based tailwind config (eg: `src/global.css`)
|
|
26
|
+
entryPoint: 'src/global.css',
|
|
27
|
+
// tailwindcss 3: the path to the tailwind config file (eg: `tailwind.config.js`)
|
|
28
|
+
tailwindConfig: 'tailwind.config.js',
|
|
29
|
+
// File to be watched, below is the default value
|
|
30
|
+
files: ['**/*.vue', '**/*.html'],
|
|
31
|
+
// To overrides rules:
|
|
32
|
+
overrides: {
|
|
33
|
+
'better-tailwindcss/enforce-logical-properties': 'error',
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
}))
|
|
22
37
|
```
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,28 @@
|
|
|
1
1
|
import antfu from "@antfu/eslint-config";
|
|
2
|
+
import { Linter } from "eslint";
|
|
2
3
|
|
|
4
|
+
//#region src/options/tailwind.d.ts
|
|
5
|
+
type TailwindRules = 'enforce-consistent-line-wrapping' | 'enforce-consistent-class-order' | 'enforce-consistent-variant-order' | 'enforce-consistent-variable-syntax' | 'enforce-consistent-important-position' | 'enforce-shorthand-classes' | 'enforce-logical-properties' | 'enforce-canonical-classes' | 'no-duplicate-classes' | 'no-deprecated-classes' | 'no-unnecessary-whitespace' | 'no-unknown-classes' | 'no-conflicting-classes' | 'no-restricted-classes';
|
|
6
|
+
interface BaseOptions {
|
|
7
|
+
files?: Linter.Config['files'];
|
|
8
|
+
overrides?: Partial<Record<TailwindRules, Linter.RuleEntry>>;
|
|
9
|
+
}
|
|
10
|
+
interface TailwindOptionsV3 extends BaseOptions {
|
|
11
|
+
tailwindConfig: string;
|
|
12
|
+
entryPoint?: never;
|
|
13
|
+
}
|
|
14
|
+
interface TailwindOptionsV4 extends BaseOptions {
|
|
15
|
+
entryPoint: string;
|
|
16
|
+
tailwindConfig?: never;
|
|
17
|
+
}
|
|
18
|
+
type TailwindOptions = TailwindOptionsV3 | TailwindOptionsV4;
|
|
19
|
+
//#endregion
|
|
3
20
|
//#region src/options/index.d.ts
|
|
4
|
-
type
|
|
21
|
+
type AntfuFirstPara = Parameters<typeof antfu>[0];
|
|
22
|
+
type Options = NonNullable<AntfuFirstPara> & {
|
|
23
|
+
tailwind?: false | TailwindOptions;
|
|
24
|
+
};
|
|
5
25
|
type UserConfig = Parameters<typeof antfu>[1];
|
|
6
26
|
declare function options(options?: Options, ...userConfigs: UserConfig[]): [Options, ...UserConfig[]];
|
|
7
27
|
//#endregion
|
|
8
|
-
export { Options, UserConfig, options };
|
|
28
|
+
export { AntfuFirstPara, Options, UserConfig, options };
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
import e from"eslint-plugin-better-tailwindcss";function t(e,t=`warn`){let{overrides:n}=typeof e==`object`?e:{};return{overrides:{"antfu/no-top-level-await":`warn`,"max-nested-callbacks":[`warn`,{max:4}],"no-alert":`off`,"no-console":`off`,"no-useless-return":`warn`,"no-unused-vars":t,"unused-imports/no-unused-imports":`warn`,"unused-imports/no-unused-vars":[`warn`,{args:`after-used`,argsIgnorePattern:`^_`,ignoreRestSiblings:!0,vars:`all`,varsIgnorePattern:`^props$|^_`}],...n}}}function n(e){let{overrides:t}=typeof e==`object`?e:{};return{overrides:{"perfectionist/sort-imports":[`error`,{groups:[`type-import`,[`type-parent`,`type-sibling`,`type-index`,`type-internal`],`value-builtin`,`value-external`,`value-internal`,[`value-parent`,`value-sibling`,`value-index`],`side-effect`,`ts-equals-import`,`unknown`],newlinesBetween:`ignore`,newlinesInside:`ignore`,order:`asc`,partitionByComment:!0,partitionByNewLine:!0,type:`natural`}],...t}}}function r(e){if(e===!1)return!1;let t=typeof e==`object`?e:{};return{...t,overrides:{"antfu/curly":`off`,"antfu/if-newline":`off`,curly:[`error`,`multi-line`,`consistent`],"style/brace-style":[`error`,`1tbs`,{allowSingleLine:!1}],"style/member-delimiter-style":[`error`,{multiline:{delimiter:`none`,requireLast:!1},multilineDetection:`brackets`,overrides:{interface:{multiline:{delimiter:`none`,requireLast:!1}}},singleline:{delimiter:`comma`}}],"style/quote-props":[`error`,`as-needed`],...t.overrides}}}function i(e){return e.tailwindConfig!==void 0}function a(e){return e.entryPoint!==void 0}function o(t){let n=typeof t==`object`?t:{};return[{name:`oli/tailwindcss/setup`,plugins:e.configs.recommended.plugins,settings:{"better-tailwindcss":{...i(n)?{tailwindConfig:n.tailwindConfig}:{},...a(n)?{entryPoint:n.entryPoint}:{}}}},{name:`oli/tailwindcss/rules`,files:n.files??[`**/*.vue`,`**/*.html`],rules:{"better-tailwindcss/enforce-consistent-line-wrapping":`warn`,"better-tailwindcss/enforce-consistent-class-order":`warn`,"better-tailwindcss/enforce-consistent-variant-order":`warn`,"better-tailwindcss/enforce-consistent-variable-syntax":`warn`,"better-tailwindcss/enforce-consistent-important-position":`warn`,"better-tailwindcss/enforce-shorthand-classes":`warn`,"better-tailwindcss/enforce-canonical-classes":`warn`,"better-tailwindcss/no-duplicate-classes":`warn`,"better-tailwindcss/no-deprecated-classes":`warn`,"better-tailwindcss/no-unnecessary-whitespace":`warn`,"better-tailwindcss/no-conflicting-classes":`error`,...n.overrides}}]}function s(e){let{overrides:t}=typeof e==`object`?e:{};return{overrides:{"ts/no-empty-function":`warn`,...t}}}function c(e){if(e===!1)return!1;let{overrides:t,...n}=typeof e==`object`?e:{};return{...n,overrides:{"vue/component-api-style":[`error`,[`script-setup`,`composition`]],"vue/block-order":[`error`,{order:[`template`,`script`,`style`]}],"vue/brace-style":[`error`,`1tbs`,{allowSingleLine:!1}],"vue/html-button-has-type":`error`,"vue/max-attributes-per-line":[`warn`,{multiline:1,singleline:4}],"vue/no-console":`error`,"vue/no-unused-refs":`warn`,"vue/no-unused-vars":`warn`,"vue/quote-props":[`error`,`as-needed`],"vue/singleline-html-element-content-newline":`off`,...t}}}function l(e={},...i){let{javascript:a,typescript:l,pnpm:u,vue:d,stylistic:f,perfectionist:p,...m}=e,h=e.tailwind?o(e.tailwind):[];return console.log(`🚀 ~ index.ts:26 ~ options ~ tailwind:`,e.tailwind),[{javascript:t(a),typescript:s(l),vue:c(d),stylistic:r(f),perfectionist:n(p),...m},...h,...i]}export{l as options};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oliver139/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "7.0
|
|
4
|
+
"version": "7.1.0",
|
|
5
5
|
"description": " Oliver's ESLint config preset powered by @antfu/eslint-config",
|
|
6
6
|
"author": "Oliver Mak <oliver139.working@gmail.com> (https://github.com/oliver139)",
|
|
7
7
|
"license": "MIT",
|
|
@@ -29,7 +29,8 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@antfu/eslint-config": "^8.3.0",
|
|
32
|
-
"eslint": "^10.3.0"
|
|
32
|
+
"eslint": "^10.3.0",
|
|
33
|
+
"eslint-plugin-better-tailwindcss": "^4.5.0"
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|
|
35
36
|
"@antfu/ni": "latest",
|