@ariel-salgado/eslint-config 0.1.5 → 0.1.7
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 +161 -0
- package/dist/index.d.ts +122 -10
- package/dist/index.js +10 -6
- package/package.json +33 -22
package/README.md
CHANGED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
## Features
|
|
2
|
+
|
|
3
|
+
This is my personal ESlint configuration, based on the [`@antfu/eslint-config`](https://github.com/antfu/eslint-config).
|
|
4
|
+
It only deviates for some minor tweaks and personal preferences.
|
|
5
|
+
|
|
6
|
+
This config adds optional rules for Tailwind, by using [`eslint-plugin-better-tailwindcss`](https://github.com/schoero/eslint-plugin-better-tailwindcss/tree/main)
|
|
7
|
+
|
|
8
|
+
Some of the main features, inherited directly from `@antfu/eslint-config`:
|
|
9
|
+
|
|
10
|
+
- Svelte and TypeScript support
|
|
11
|
+
- Linting for JSON, YAML, Markdown
|
|
12
|
+
- Uses the easily extensible [ESLint Flat config](https://eslint.org/docs/latest/use/configure/configuration-files-new)
|
|
13
|
+
- Includes [ESLint Stylistic](https://github.com/eslint-stylistic/eslint-stylistic) to format code and enforce a preconfigured style
|
|
14
|
+
- ... and many more
|
|
15
|
+
|
|
16
|
+
## Setup
|
|
17
|
+
|
|
18
|
+
### Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pnpm i -D eslint @ariel-salgado/eslint-config
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Basic usage
|
|
25
|
+
|
|
26
|
+
```js
|
|
27
|
+
// eslint.config.js
|
|
28
|
+
import defineConfig from '@ariel-salgado/eslint-config';
|
|
29
|
+
|
|
30
|
+
export default defineConfig();
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
#### Setting options and using custom rules
|
|
34
|
+
|
|
35
|
+
It is possible to add custom rules with the following configuration.
|
|
36
|
+
|
|
37
|
+
```js
|
|
38
|
+
// eslint.config.js
|
|
39
|
+
import defineConfig from '@ariel-salgado/eslint-config';
|
|
40
|
+
|
|
41
|
+
export default defineConfig({
|
|
42
|
+
type: 'app',
|
|
43
|
+
svelte: true,
|
|
44
|
+
typescript: true,
|
|
45
|
+
tailwindcss: true,
|
|
46
|
+
});
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## VS Code Support
|
|
50
|
+
|
|
51
|
+
If you use VS Code, you should manually enable support for ESLint flat config.
|
|
52
|
+
|
|
53
|
+
Install [VS Code ESLint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint).
|
|
54
|
+
|
|
55
|
+
Add the following settings to your `.vscode/settings.json`:
|
|
56
|
+
|
|
57
|
+
```jsonc
|
|
58
|
+
{
|
|
59
|
+
// Disable the default formatter, use eslint instead
|
|
60
|
+
"prettier.enable": false,
|
|
61
|
+
"editor.formatOnSave": false,
|
|
62
|
+
|
|
63
|
+
// Auto fix
|
|
64
|
+
"editor.codeActionsOnSave": {
|
|
65
|
+
"source.fixAll.eslint": "explicit",
|
|
66
|
+
"source.organizeImports": "never"
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
// Silent the stylistic rules in you IDE, but still auto fix them
|
|
70
|
+
"eslint.rules.customizations": [
|
|
71
|
+
{ "rule": "style/*", "severity": "off", "fixable": true },
|
|
72
|
+
{ "rule": "format/*", "severity": "off", "fixable": true },
|
|
73
|
+
{ "rule": "*-indent", "severity": "off", "fixable": true },
|
|
74
|
+
{ "rule": "*-spacing", "severity": "off", "fixable": true },
|
|
75
|
+
{ "rule": "*-spaces", "severity": "off", "fixable": true },
|
|
76
|
+
{ "rule": "*-order", "severity": "off", "fixable": true },
|
|
77
|
+
{ "rule": "*-dangle", "severity": "off", "fixable": true },
|
|
78
|
+
{ "rule": "*-newline", "severity": "off", "fixable": true },
|
|
79
|
+
{ "rule": "*quotes", "severity": "off", "fixable": true },
|
|
80
|
+
{ "rule": "*semi", "severity": "off", "fixable": true }
|
|
81
|
+
],
|
|
82
|
+
|
|
83
|
+
// Enable eslint for all supported languages
|
|
84
|
+
"eslint.validate": [
|
|
85
|
+
"javascript",
|
|
86
|
+
"javascriptreact",
|
|
87
|
+
"typescript",
|
|
88
|
+
"typescriptreact",
|
|
89
|
+
"vue",
|
|
90
|
+
"html",
|
|
91
|
+
"markdown",
|
|
92
|
+
"json",
|
|
93
|
+
"jsonc",
|
|
94
|
+
"yaml",
|
|
95
|
+
"toml",
|
|
96
|
+
"xml",
|
|
97
|
+
"gql",
|
|
98
|
+
"graphql",
|
|
99
|
+
"astro",
|
|
100
|
+
"svelte",
|
|
101
|
+
"css",
|
|
102
|
+
"less",
|
|
103
|
+
"scss",
|
|
104
|
+
"pcss",
|
|
105
|
+
"postcss"
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Neovim Support
|
|
111
|
+
|
|
112
|
+
Using Neovim +0.11 you should setup your ESLint LSP, and then update your configuration to apply the settings:
|
|
113
|
+
|
|
114
|
+
```lua
|
|
115
|
+
vim.lsp.enable({
|
|
116
|
+
"eslint",
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
vim.lsp.config("eslint", {
|
|
120
|
+
filetypes = {
|
|
121
|
+
"javascript",
|
|
122
|
+
"javascriptreact",
|
|
123
|
+
"javascript.jsx",
|
|
124
|
+
"typescript",
|
|
125
|
+
"typescriptreact",
|
|
126
|
+
"typescript.tsx",
|
|
127
|
+
"vue",
|
|
128
|
+
"html",
|
|
129
|
+
"markdown",
|
|
130
|
+
"json",
|
|
131
|
+
"jsonc",
|
|
132
|
+
"yaml",
|
|
133
|
+
"toml",
|
|
134
|
+
"xml",
|
|
135
|
+
"gql",
|
|
136
|
+
"graphql",
|
|
137
|
+
"astro",
|
|
138
|
+
"svelte",
|
|
139
|
+
"css",
|
|
140
|
+
"less",
|
|
141
|
+
"scss",
|
|
142
|
+
"pcss",
|
|
143
|
+
"postcss",
|
|
144
|
+
},
|
|
145
|
+
settings = {
|
|
146
|
+
rulesCustomizations = {
|
|
147
|
+
{ rule = "style/*", severity = "off", fixable = true },
|
|
148
|
+
{ rule = "format/*", severity = "off", fixable = true },
|
|
149
|
+
{ rule = "*-indent", severity = "off", fixable = true },
|
|
150
|
+
{ rule = "*-spacing", severity = "off", fixable = true },
|
|
151
|
+
{ rule = "*-spaces", severity = "off", fixable = true },
|
|
152
|
+
{ rule = "*-order", severity = "off", fixable = true },
|
|
153
|
+
{ rule = "*-dangle", severity = "off", fixable = true },
|
|
154
|
+
{ rule = "*-newline", severity = "off", fixable = true },
|
|
155
|
+
{ rule = "*quotes", severity = "off", fixable = true },
|
|
156
|
+
{ rule = "*semi", severity = "off", fixable = true },
|
|
157
|
+
{ rule = "*/indent", severity = "off", fixable = true },
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
})
|
|
161
|
+
```
|
package/dist/index.d.ts
CHANGED
|
@@ -755,6 +755,26 @@ interface RuleOptions {
|
|
|
755
755
|
* @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/text-escaping.md#repos-sticky-header
|
|
756
756
|
*/
|
|
757
757
|
'jsdoc/text-escaping'?: Linter.RuleEntry<JsdocTextEscaping>;
|
|
758
|
+
/**
|
|
759
|
+
* Prefers either function properties or method signatures
|
|
760
|
+
* @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/ts-method-signature-style.md#repos-sticky-header
|
|
761
|
+
*/
|
|
762
|
+
'jsdoc/ts-method-signature-style'?: Linter.RuleEntry<JsdocTsMethodSignatureStyle>;
|
|
763
|
+
/**
|
|
764
|
+
* Warns against use of the empty object type
|
|
765
|
+
* @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/ts-no-empty-object-type.md#repos-sticky-header
|
|
766
|
+
*/
|
|
767
|
+
'jsdoc/ts-no-empty-object-type'?: Linter.RuleEntry<[]>;
|
|
768
|
+
/**
|
|
769
|
+
* Catches unnecessary template expressions such as string expressions within a template literal.
|
|
770
|
+
* @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/ts-no-unnecessary-template-expression.md#repos-sticky-header
|
|
771
|
+
*/
|
|
772
|
+
'jsdoc/ts-no-unnecessary-template-expression'?: Linter.RuleEntry<JsdocTsNoUnnecessaryTemplateExpression>;
|
|
773
|
+
/**
|
|
774
|
+
* Prefers function types over call signatures when there are no other properties.
|
|
775
|
+
* @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/ts-prefer-function-type.md#repos-sticky-header
|
|
776
|
+
*/
|
|
777
|
+
'jsdoc/ts-prefer-function-type'?: Linter.RuleEntry<JsdocTsPreferFunctionType>;
|
|
758
778
|
/**
|
|
759
779
|
* Formats JSDoc type values.
|
|
760
780
|
* @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/type-formatting.md#repos-sticky-header
|
|
@@ -3115,6 +3135,11 @@ interface RuleOptions {
|
|
|
3115
3135
|
* @see https://eslint.style/rules/eol-last
|
|
3116
3136
|
*/
|
|
3117
3137
|
'style/eol-last'?: Linter.RuleEntry<StyleEolLast>;
|
|
3138
|
+
/**
|
|
3139
|
+
* Enforce consistent spacing and line break styles inside brackets.
|
|
3140
|
+
* @see https://eslint.style/rules/list-style
|
|
3141
|
+
*/
|
|
3142
|
+
'style/exp-list-style'?: Linter.RuleEntry<StyleExpListStyle>;
|
|
3118
3143
|
/**
|
|
3119
3144
|
* Enforce line breaks between arguments of a function call
|
|
3120
3145
|
* @see https://eslint.style/rules/function-call-argument-newline
|
|
@@ -4012,7 +4037,7 @@ interface RuleOptions {
|
|
|
4012
4037
|
*/
|
|
4013
4038
|
'template-tag-spacing'?: Linter.RuleEntry<TemplateTagSpacing>;
|
|
4014
4039
|
/**
|
|
4015
|
-
* require
|
|
4040
|
+
* require test file pattern
|
|
4016
4041
|
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/consistent-test-filename.md
|
|
4017
4042
|
*/
|
|
4018
4043
|
'test/consistent-test-filename'?: Linter.RuleEntry<TestConsistentTestFilename>;
|
|
@@ -4925,7 +4950,7 @@ interface RuleOptions {
|
|
|
4925
4950
|
* Disallow member access on a value with type `any`
|
|
4926
4951
|
* @see https://typescript-eslint.io/rules/no-unsafe-member-access
|
|
4927
4952
|
*/
|
|
4928
|
-
'ts/no-unsafe-member-access'?: Linter.RuleEntry<
|
|
4953
|
+
'ts/no-unsafe-member-access'?: Linter.RuleEntry<TsNoUnsafeMemberAccess>;
|
|
4929
4954
|
/**
|
|
4930
4955
|
* Disallow returning a value with type `any` from a function
|
|
4931
4956
|
* @see https://typescript-eslint.io/rules/no-unsafe-return
|
|
@@ -6895,16 +6920,44 @@ type JsdocTextEscaping = [] | [{
|
|
|
6895
6920
|
escapeHTML?: boolean;
|
|
6896
6921
|
escapeMarkdown?: boolean;
|
|
6897
6922
|
}];
|
|
6923
|
+
// ----- jsdoc/ts-method-signature-style -----
|
|
6924
|
+
type JsdocTsMethodSignatureStyle = [] | [("method" | "property")] | [("method" | "property"), {
|
|
6925
|
+
enableFixer?: boolean;
|
|
6926
|
+
}];
|
|
6927
|
+
// ----- jsdoc/ts-no-unnecessary-template-expression -----
|
|
6928
|
+
type JsdocTsNoUnnecessaryTemplateExpression = [] | [{
|
|
6929
|
+
enableFixer?: boolean;
|
|
6930
|
+
}];
|
|
6931
|
+
// ----- jsdoc/ts-prefer-function-type -----
|
|
6932
|
+
type JsdocTsPreferFunctionType = [] | [{
|
|
6933
|
+
enableFixer?: boolean;
|
|
6934
|
+
}];
|
|
6898
6935
|
// ----- jsdoc/type-formatting -----
|
|
6899
6936
|
type JsdocTypeFormatting = [] | [{
|
|
6900
6937
|
arrayBrackets?: ("angle" | "square");
|
|
6938
|
+
arrowFunctionPostReturnMarkerSpacing?: string;
|
|
6939
|
+
arrowFunctionPreReturnMarkerSpacing?: string;
|
|
6901
6940
|
enableFixer?: boolean;
|
|
6941
|
+
functionOrClassParameterSpacing?: string;
|
|
6942
|
+
functionOrClassPostGenericSpacing?: string;
|
|
6943
|
+
functionOrClassPostReturnMarkerSpacing?: string;
|
|
6944
|
+
functionOrClassPreReturnMarkerSpacing?: string;
|
|
6945
|
+
functionOrClassTypeParameterSpacing?: string;
|
|
6946
|
+
genericAndTupleElementSpacing?: string;
|
|
6902
6947
|
genericDot?: boolean;
|
|
6948
|
+
keyValuePostColonSpacing?: string;
|
|
6949
|
+
keyValuePostKeySpacing?: string;
|
|
6950
|
+
keyValuePostOptionalSpacing?: string;
|
|
6951
|
+
keyValuePostVariadicSpacing?: string;
|
|
6952
|
+
methodQuotes?: ("double" | "single");
|
|
6903
6953
|
objectFieldIndent?: string;
|
|
6904
6954
|
objectFieldQuote?: ("double" | "single" | null);
|
|
6905
6955
|
objectFieldSeparator?: ("comma" | "comma-and-linebreak" | "linebreak" | "semicolon" | "semicolon-and-linebreak");
|
|
6906
6956
|
objectFieldSeparatorOptionalLinebreak?: boolean;
|
|
6907
6957
|
objectFieldSeparatorTrailingPunctuation?: boolean;
|
|
6958
|
+
parameterDefaultValueSpacing?: string;
|
|
6959
|
+
postMethodNameSpacing?: string;
|
|
6960
|
+
postNewSpacing?: string;
|
|
6908
6961
|
separatorForSingleObjectField?: boolean;
|
|
6909
6962
|
stringQuotes?: ("double" | "single");
|
|
6910
6963
|
typeBracketSpacing?: string;
|
|
@@ -7986,12 +8039,14 @@ type NoRestrictedImports = ((string | {
|
|
|
7986
8039
|
message?: string;
|
|
7987
8040
|
importNames?: string[];
|
|
7988
8041
|
allowImportNames?: string[];
|
|
8042
|
+
allowTypeImports?: boolean;
|
|
7989
8043
|
})[] | [] | [{
|
|
7990
8044
|
paths?: (string | {
|
|
7991
8045
|
name: string;
|
|
7992
8046
|
message?: string;
|
|
7993
8047
|
importNames?: string[];
|
|
7994
8048
|
allowImportNames?: string[];
|
|
8049
|
+
allowTypeImports?: boolean;
|
|
7995
8050
|
})[];
|
|
7996
8051
|
patterns?: (string[] | ({
|
|
7997
8052
|
[k: string]: unknown | undefined;
|
|
@@ -10248,6 +10303,7 @@ type PnpmJsonValidCatalog = [] | [{
|
|
|
10248
10303
|
// ----- pnpm/yaml-no-duplicate-catalog-item -----
|
|
10249
10304
|
type PnpmYamlNoDuplicateCatalogItem = [] | [{
|
|
10250
10305
|
allow?: string[];
|
|
10306
|
+
checkDuplicates?: ("name-only" | "exact-version");
|
|
10251
10307
|
}];
|
|
10252
10308
|
// ----- prefer-arrow-callback -----
|
|
10253
10309
|
type PreferArrowCallback = [] | [{
|
|
@@ -10706,6 +10762,50 @@ type StyleCurlyNewline = [] | [(("always" | "never") | {
|
|
|
10706
10762
|
type StyleDotLocation = [] | [("object" | "property")];
|
|
10707
10763
|
// ----- style/eol-last -----
|
|
10708
10764
|
type StyleEolLast = [] | [("always" | "never" | "unix" | "windows")];
|
|
10765
|
+
// ----- style/exp-list-style -----
|
|
10766
|
+
type StyleExpListStyle = [] | [{
|
|
10767
|
+
singleLine?: _StyleExpListStyle_SingleLineConfig;
|
|
10768
|
+
multiLine?: _StyleExpListStyle_MultiLineConfig;
|
|
10769
|
+
overrides?: {
|
|
10770
|
+
"[]"?: _StyleExpListStyle_BaseConfig;
|
|
10771
|
+
"{}"?: _StyleExpListStyle_BaseConfig;
|
|
10772
|
+
"<>"?: _StyleExpListStyle_BaseConfig;
|
|
10773
|
+
"()"?: _StyleExpListStyle_BaseConfig;
|
|
10774
|
+
ArrayExpression?: _StyleExpListStyle_BaseConfig;
|
|
10775
|
+
ArrayPattern?: _StyleExpListStyle_BaseConfig;
|
|
10776
|
+
ArrowFunctionExpression?: _StyleExpListStyle_BaseConfig;
|
|
10777
|
+
CallExpression?: _StyleExpListStyle_BaseConfig;
|
|
10778
|
+
ExportNamedDeclaration?: _StyleExpListStyle_BaseConfig;
|
|
10779
|
+
FunctionDeclaration?: _StyleExpListStyle_BaseConfig;
|
|
10780
|
+
FunctionExpression?: _StyleExpListStyle_BaseConfig;
|
|
10781
|
+
ImportDeclaration?: _StyleExpListStyle_BaseConfig;
|
|
10782
|
+
ImportAttributes?: _StyleExpListStyle_BaseConfig;
|
|
10783
|
+
NewExpression?: _StyleExpListStyle_BaseConfig;
|
|
10784
|
+
ObjectExpression?: _StyleExpListStyle_BaseConfig;
|
|
10785
|
+
ObjectPattern?: _StyleExpListStyle_BaseConfig;
|
|
10786
|
+
TSDeclareFunction?: _StyleExpListStyle_BaseConfig;
|
|
10787
|
+
TSFunctionType?: _StyleExpListStyle_BaseConfig;
|
|
10788
|
+
TSInterfaceBody?: _StyleExpListStyle_BaseConfig;
|
|
10789
|
+
TSEnumBody?: _StyleExpListStyle_BaseConfig;
|
|
10790
|
+
TSTupleType?: _StyleExpListStyle_BaseConfig;
|
|
10791
|
+
TSTypeLiteral?: _StyleExpListStyle_BaseConfig;
|
|
10792
|
+
TSTypeParameterDeclaration?: _StyleExpListStyle_BaseConfig;
|
|
10793
|
+
TSTypeParameterInstantiation?: _StyleExpListStyle_BaseConfig;
|
|
10794
|
+
JSONArrayExpression?: _StyleExpListStyle_BaseConfig;
|
|
10795
|
+
JSONObjectExpression?: _StyleExpListStyle_BaseConfig;
|
|
10796
|
+
};
|
|
10797
|
+
}];
|
|
10798
|
+
interface _StyleExpListStyle_SingleLineConfig {
|
|
10799
|
+
spacing?: ("always" | "never");
|
|
10800
|
+
maxItems?: number;
|
|
10801
|
+
}
|
|
10802
|
+
interface _StyleExpListStyle_MultiLineConfig {
|
|
10803
|
+
minItems?: number;
|
|
10804
|
+
}
|
|
10805
|
+
interface _StyleExpListStyle_BaseConfig {
|
|
10806
|
+
singleLine?: _StyleExpListStyle_SingleLineConfig;
|
|
10807
|
+
multiline?: _StyleExpListStyle_MultiLineConfig;
|
|
10808
|
+
}
|
|
10709
10809
|
// ----- style/function-call-argument-newline -----
|
|
10710
10810
|
type StyleFunctionCallArgumentNewline = [] | [("always" | "never" | "consistent")];
|
|
10711
10811
|
// ----- style/function-call-spacing -----
|
|
@@ -10775,7 +10875,11 @@ type StyleIndent = [] | [("tab" | number)] | [("tab" | number), {
|
|
|
10775
10875
|
ObjectExpression?: (number | ("first" | "off"));
|
|
10776
10876
|
ImportDeclaration?: (number | ("first" | "off"));
|
|
10777
10877
|
flatTernaryExpressions?: boolean;
|
|
10778
|
-
offsetTernaryExpressions?: boolean
|
|
10878
|
+
offsetTernaryExpressions?: (boolean | {
|
|
10879
|
+
CallExpression?: boolean;
|
|
10880
|
+
AwaitExpression?: boolean;
|
|
10881
|
+
NewExpression?: boolean;
|
|
10882
|
+
});
|
|
10779
10883
|
offsetTernaryExpressionsOffsetCallExpressions?: boolean;
|
|
10780
10884
|
ignoredNodes?: string[];
|
|
10781
10885
|
ignoreComments?: boolean;
|
|
@@ -11576,6 +11680,7 @@ type StyleObjectCurlySpacing = [] | [("always" | "never")] | [("always" | "never
|
|
|
11576
11680
|
TSInterfaceBody?: ("always" | "never");
|
|
11577
11681
|
TSEnumBody?: ("always" | "never");
|
|
11578
11682
|
};
|
|
11683
|
+
emptyObjects?: ("ignore" | "always" | "never");
|
|
11579
11684
|
}];
|
|
11580
11685
|
// ----- style/object-property-newline -----
|
|
11581
11686
|
type StyleObjectPropertyNewline = [] | [{
|
|
@@ -13409,6 +13514,10 @@ type TsNoUnnecessaryTypeAssertion = [] | [{
|
|
|
13409
13514
|
checkLiteralConstAssertions?: boolean;
|
|
13410
13515
|
typesToIgnore?: string[];
|
|
13411
13516
|
}];
|
|
13517
|
+
// ----- ts/no-unsafe-member-access -----
|
|
13518
|
+
type TsNoUnsafeMemberAccess = [] | [{
|
|
13519
|
+
allowOptionalChaining?: boolean;
|
|
13520
|
+
}];
|
|
13412
13521
|
// ----- ts/no-unused-expressions -----
|
|
13413
13522
|
type TsNoUnusedExpressions = [] | [{
|
|
13414
13523
|
allowShortCircuit?: boolean;
|
|
@@ -13426,6 +13535,7 @@ type TsNoUnusedVars = [] | [(("all" | "local") | {
|
|
|
13426
13535
|
destructuredArrayIgnorePattern?: string;
|
|
13427
13536
|
ignoreClassWithStaticInitBlock?: boolean;
|
|
13428
13537
|
ignoreRestSiblings?: boolean;
|
|
13538
|
+
ignoreUsingDeclarations?: boolean;
|
|
13429
13539
|
reportUsedIgnorePattern?: boolean;
|
|
13430
13540
|
vars?: ("all" | "local");
|
|
13431
13541
|
varsIgnorePattern?: string;
|
|
@@ -13885,6 +13995,7 @@ type UnusedImportsNoUnusedImports = [] | [(("all" | "local") | {
|
|
|
13885
13995
|
destructuredArrayIgnorePattern?: string;
|
|
13886
13996
|
ignoreClassWithStaticInitBlock?: boolean;
|
|
13887
13997
|
ignoreRestSiblings?: boolean;
|
|
13998
|
+
ignoreUsingDeclarations?: boolean;
|
|
13888
13999
|
reportUsedIgnorePattern?: boolean;
|
|
13889
14000
|
vars?: ("all" | "local");
|
|
13890
14001
|
varsIgnorePattern?: string;
|
|
@@ -13898,6 +14009,7 @@ type UnusedImportsNoUnusedVars = [] | [(("all" | "local") | {
|
|
|
13898
14009
|
destructuredArrayIgnorePattern?: string;
|
|
13899
14010
|
ignoreClassWithStaticInitBlock?: boolean;
|
|
13900
14011
|
ignoreRestSiblings?: boolean;
|
|
14012
|
+
ignoreUsingDeclarations?: boolean;
|
|
13901
14013
|
reportUsedIgnorePattern?: boolean;
|
|
13902
14014
|
vars?: ("all" | "local");
|
|
13903
14015
|
varsIgnorePattern?: string;
|
|
@@ -14134,7 +14246,7 @@ type Yoda = [] | [("always" | "never")] | [("always" | "never"), {
|
|
|
14134
14246
|
onlyEquality?: boolean;
|
|
14135
14247
|
}];
|
|
14136
14248
|
// Names of all the configs
|
|
14137
|
-
type ConfigNames = 'ariel/eslint-comments/rules' | 'ariel/disables/scripts' | 'ariel/disables/dts' | 'ariel/disables/cjs' | 'ariel/disables/config-files' | 'ariel/ignores' | 'gitignore' | 'ariel/imports/rules' | 'ariel/javascript/setup' | 'ariel/javascript/rules' | 'ariel/jsdoc/rules' | 'ariel/jsonc/setup' | 'ariel/jsonc/rules' | 'ariel/markdown/setup' | 'ariel/markdown/processor' | 'ariel/markdown/parser' | 'ariel/markdown/disables' | 'ariel/morgan/rules' | 'ariel/node' | 'ariel/perfectionist/setup' | 'ariel/pnpm/package-json' | 'ariel/pnpm/pnpm-workspace-yaml' | 'ariel/regexp/rules' | 'ariel/sort/package-json' | 'ariel/sort/tsconfig-json' | 'ariel/stylistic/rules' | 'ariel/svelte/setup' | 'ariel/svelte/rules' | 'ariel/tailwindcss/setup' | 'ariel/tailwindcss/rules' | 'ariel/test/setup' | 'ariel/test/rules' | 'ariel/toml/setup' | 'ariel/toml/rules' | 'ariel/typescript/setup' | 'ariel/typescript/parser' | 'ariel/typescript/rules' | 'ariel/unicorn/rules' | 'ariel/yaml/setup' | 'ariel/yaml/rules' | 'ariel/yaml/pnpm-workspace';
|
|
14249
|
+
type ConfigNames = 'ariel/eslint-comments/rules' | 'ariel/disables/scripts' | 'ariel/disables/dts' | 'ariel/disables/cjs' | 'ariel/disables/config-files' | 'ariel/global-ignores' | 'gitignore' | 'ariel/imports/rules' | 'ariel/javascript/setup' | 'ariel/javascript/rules' | 'ariel/jsdoc/rules' | 'ariel/jsonc/setup' | 'ariel/jsonc/rules' | 'ariel/markdown/setup' | 'ariel/markdown/processor' | 'ariel/markdown/parser' | 'ariel/markdown/disables' | 'ariel/morgan/rules' | 'ariel/node/rules' | 'ariel/perfectionist/setup' | 'ariel/pnpm/package-json' | 'ariel/pnpm/pnpm-workspace-yaml' | 'ariel/regexp/rules' | 'ariel/sort/package-json' | 'ariel/sort/tsconfig-json' | 'ariel/stylistic/rules' | 'ariel/svelte/setup' | 'ariel/svelte/rules' | 'ariel/tailwindcss/setup' | 'ariel/tailwindcss/rules' | 'ariel/test/setup' | 'ariel/test/rules' | 'ariel/toml/setup' | 'ariel/toml/rules' | 'ariel/typescript/setup' | 'ariel/typescript/parser' | 'ariel/typescript/rules' | 'ariel/unicorn/rules' | 'ariel/yaml/setup' | 'ariel/yaml/rules' | 'ariel/yaml/pnpm-workspace';
|
|
14138
14250
|
//#endregion
|
|
14139
14251
|
//#region src/types.d.ts
|
|
14140
14252
|
type Awaitable<T> = T | Promise<T>;
|
|
@@ -14170,15 +14282,15 @@ interface OptionsStylistic {
|
|
|
14170
14282
|
}
|
|
14171
14283
|
interface StylisticConfig extends Pick<StylisticCustomizeOptions, 'indent' | 'quotes' | 'semi'> {}
|
|
14172
14284
|
interface StylisticOptions extends StylisticConfig, OptionsOverrides {}
|
|
14285
|
+
interface OptionsOverrides {
|
|
14286
|
+
overrides?: TypedFlatConfigItem['rules'];
|
|
14287
|
+
}
|
|
14173
14288
|
interface OptionsHasTailwindCSS {
|
|
14174
14289
|
tailwindcss?: boolean;
|
|
14175
14290
|
}
|
|
14176
14291
|
interface TailwindCSSOptions extends OptionsOverrides {
|
|
14177
14292
|
entryPoint?: string;
|
|
14178
14293
|
}
|
|
14179
|
-
interface OptionsOverrides {
|
|
14180
|
-
overrides?: TypedFlatConfigItem['rules'];
|
|
14181
|
-
}
|
|
14182
14294
|
interface OptionsProjectType {
|
|
14183
14295
|
type?: 'app' | 'lib';
|
|
14184
14296
|
}
|
|
@@ -14257,7 +14369,7 @@ interface OptionsConfig extends OptionsComponentExts, OptionsProjectType {
|
|
|
14257
14369
|
* @see https://eslint.style/
|
|
14258
14370
|
* @default true
|
|
14259
14371
|
*/
|
|
14260
|
-
stylistic?: boolean |
|
|
14372
|
+
stylistic?: boolean | StylisticOptions;
|
|
14261
14373
|
/**
|
|
14262
14374
|
* Enable regexp rules.
|
|
14263
14375
|
*
|
|
@@ -14359,7 +14471,7 @@ declare const GLOB_JSON5 = "**/*.json5";
|
|
|
14359
14471
|
declare const GLOB_JSONC = "**/*.jsonc";
|
|
14360
14472
|
declare const GLOB_MARKDOWN = "**/*.md";
|
|
14361
14473
|
declare const GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
|
|
14362
|
-
declare const GLOB_SVELTE = "**/*.svelte{
|
|
14474
|
+
declare const GLOB_SVELTE = "**/*.svelte?(.{js,ts})";
|
|
14363
14475
|
declare const GLOB_YAML = "**/*.y?(a)ml";
|
|
14364
14476
|
declare const GLOB_TOML = "**/*.toml";
|
|
14365
14477
|
declare const GLOB_XML = "**/*.xml";
|
|
@@ -14474,4 +14586,4 @@ declare function tailwindcss(options?: OptionsHasTailwindCSS & TailwindCSSOption
|
|
|
14474
14586
|
//#region src/configs/perfectionist.d.ts
|
|
14475
14587
|
declare function perfectionist(): Promise<TypedFlatConfigItem[]>;
|
|
14476
14588
|
//#endregion
|
|
14477
|
-
export { Awaitable, type ConfigNames, GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_XML, GLOB_YAML, OptionsComponentExts, OptionsConfig, OptionsFiles, OptionsHasTailwindCSS, OptionsHasTypeScript, OptionsOverrides, OptionsProjectType, OptionsRegExp, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescript, OptionsUnicorn, ResolvedOptions, Rules, StylisticConfig, StylisticOptions, TailwindCSSOptions, TypedFlatConfigItem, ariel,
|
|
14589
|
+
export { Awaitable, type ConfigNames, GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_XML, GLOB_YAML, OptionsComponentExts, OptionsConfig, OptionsFiles, OptionsHasTailwindCSS, OptionsHasTypeScript, OptionsOverrides, OptionsProjectType, OptionsRegExp, OptionsStylistic, OptionsTypeScriptParserOptions, OptionsTypeScriptWithTypes, OptionsTypescript, OptionsUnicorn, ResolvedOptions, Rules, StylisticConfig, StylisticOptions, TailwindCSSOptions, TypedFlatConfigItem, ariel, ariel as default, combine, comments, default_plugin_renaming, defaults, disables, ensure_packages, get_overrides, ignores, imports, interop_default, is_package_in_scope, javascript, jsdoc, jsonc, markdown, morgan, node, parser_plain, perfectionist, pnpm, regexp, rename_plugin_in_configs, rename_rules, resolve_sub_options, sort_package_json, sort_ts_config, stylistic, svelte, tailwindcss, test, to_array, toml, typescript, unicorn, yaml };
|
package/dist/index.js
CHANGED
|
@@ -17,7 +17,7 @@ import globals from "globals";
|
|
|
17
17
|
|
|
18
18
|
//#region src/utils.ts
|
|
19
19
|
const scope_url = fileURLToPath(new URL(".", import.meta.url));
|
|
20
|
-
const is_cwd_in_scope = isPackageExists("@ariel/eslint-config");
|
|
20
|
+
const is_cwd_in_scope = isPackageExists("@ariel-salgado/eslint-config");
|
|
21
21
|
const parser_plain = {
|
|
22
22
|
meta: { name: "parser-plain" },
|
|
23
23
|
parseForESLint: (code) => ({
|
|
@@ -76,6 +76,9 @@ async function ensure_packages(packages) {
|
|
|
76
76
|
|
|
77
77
|
//#endregion
|
|
78
78
|
//#region src/env.ts
|
|
79
|
+
function has_typescript() {
|
|
80
|
+
return isPackageExists("typescript");
|
|
81
|
+
}
|
|
79
82
|
function has_svelte() {
|
|
80
83
|
return isPackageExists("svelte") || isPackageExists("@sveltejs/kit");
|
|
81
84
|
}
|
|
@@ -95,7 +98,7 @@ function is_in_editor_env() {
|
|
|
95
98
|
//#region src/configs/node.ts
|
|
96
99
|
async function node() {
|
|
97
100
|
return [{
|
|
98
|
-
name: "ariel/node",
|
|
101
|
+
name: "ariel/node/rules",
|
|
99
102
|
plugins: { node: plugin_node },
|
|
100
103
|
rules: {
|
|
101
104
|
"node/handle-callback-err": ["error", "^(err|error)$"],
|
|
@@ -200,7 +203,8 @@ async function sort_package_json() {
|
|
|
200
203
|
"husky",
|
|
201
204
|
"simple-git-hooks",
|
|
202
205
|
"lint-staged",
|
|
203
|
-
"eslintConfig"
|
|
206
|
+
"eslintConfig",
|
|
207
|
+
"tsdown"
|
|
204
208
|
],
|
|
205
209
|
pathPattern: "^$"
|
|
206
210
|
},
|
|
@@ -381,7 +385,7 @@ const GLOB_JSON5 = "**/*.json5";
|
|
|
381
385
|
const GLOB_JSONC = "**/*.jsonc";
|
|
382
386
|
const GLOB_MARKDOWN = "**/*.md";
|
|
383
387
|
const GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
|
|
384
|
-
const GLOB_SVELTE = "**/*.svelte{
|
|
388
|
+
const GLOB_SVELTE = "**/*.svelte?(.{js,ts})";
|
|
385
389
|
const GLOB_YAML = "**/*.y?(a)ml";
|
|
386
390
|
const GLOB_TOML = "**/*.toml";
|
|
387
391
|
const GLOB_XML = "**/*.xml";
|
|
@@ -802,7 +806,7 @@ async function svelte(options = {}) {
|
|
|
802
806
|
//#region src/configs/ignores.ts
|
|
803
807
|
async function ignores(ignores$1 = []) {
|
|
804
808
|
return [{
|
|
805
|
-
name: "ariel/ignores",
|
|
809
|
+
name: "ariel/global-ignores",
|
|
806
810
|
ignores: [...GLOB_EXCLUDE, ...ignores$1]
|
|
807
811
|
}, {
|
|
808
812
|
name: "ariel/gitignore",
|
|
@@ -1517,7 +1521,7 @@ const default_plugin_renaming = {
|
|
|
1517
1521
|
* The merged ESLint configurations.
|
|
1518
1522
|
*/
|
|
1519
1523
|
function ariel(options = {}, ...userConfigs) {
|
|
1520
|
-
const { autoRenamePlugins = true, componentExts = [], gitignore: enable_git_ignore = true, imports: enable_imports = true, pnpm: enable_catalogs = false, regexp: enable_regexp = true, svelte: enable_svelte = has_svelte(), tailwindcss: enable_tailwindcss = has_tailwindcss(), typescript: enable_typescript =
|
|
1524
|
+
const { autoRenamePlugins = true, componentExts = [], gitignore: enable_git_ignore = true, imports: enable_imports = true, pnpm: enable_catalogs = false, regexp: enable_regexp = true, svelte: enable_svelte = has_svelte(), tailwindcss: enable_tailwindcss = has_tailwindcss(), typescript: enable_typescript = has_typescript(), unicorn: enable_unicorn = true } = options;
|
|
1521
1525
|
const is_in_editor = is_in_editor_env();
|
|
1522
1526
|
if (is_in_editor) console.log("[@ariel-salgado/eslint-config] Detected running in editor, some rules are disabled.");
|
|
1523
1527
|
const stylistic_options = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ariel-salgado/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.7",
|
|
5
5
|
"description": "ESLint config for @ariel-salgado.",
|
|
6
6
|
"author": "Ariel Salgado <ariel.salgado.acevedo@gmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -44,28 +44,28 @@
|
|
|
44
44
|
"@antfu/install-pkg": "^1.1.0",
|
|
45
45
|
"@clack/prompts": "^0.11.0",
|
|
46
46
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.5.0",
|
|
47
|
-
"@eslint/markdown": "^7.
|
|
48
|
-
"@stylistic/eslint-plugin": "^5.
|
|
49
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
50
|
-
"@typescript-eslint/parser": "^8.
|
|
51
|
-
"@vitest/eslint-plugin": "^1.3.
|
|
47
|
+
"@eslint/markdown": "^7.4.1",
|
|
48
|
+
"@stylistic/eslint-plugin": "^5.5.0",
|
|
49
|
+
"@typescript-eslint/eslint-plugin": "^8.46.2",
|
|
50
|
+
"@typescript-eslint/parser": "^8.46.2",
|
|
51
|
+
"@vitest/eslint-plugin": "^1.3.23",
|
|
52
52
|
"eslint-config-flat-gitignore": "^2.1.0",
|
|
53
53
|
"eslint-flat-config-utils": "^2.1.4",
|
|
54
54
|
"eslint-merge-processors": "^2.0.0",
|
|
55
55
|
"eslint-plugin-ariel": "^0.0.3",
|
|
56
56
|
"eslint-plugin-de-morgan": "^2.0.0",
|
|
57
57
|
"eslint-plugin-import-lite": "^0.3.0",
|
|
58
|
-
"eslint-plugin-jsdoc": "^
|
|
59
|
-
"eslint-plugin-jsonc": "^2.
|
|
58
|
+
"eslint-plugin-jsdoc": "^61.1.5",
|
|
59
|
+
"eslint-plugin-jsonc": "^2.21.0",
|
|
60
60
|
"eslint-plugin-n": "^17.23.1",
|
|
61
61
|
"eslint-plugin-no-only-tests": "^3.3.0",
|
|
62
|
-
"eslint-plugin-perfectionist": "^4.15.
|
|
63
|
-
"eslint-plugin-pnpm": "^1.
|
|
62
|
+
"eslint-plugin-perfectionist": "^4.15.1",
|
|
63
|
+
"eslint-plugin-pnpm": "^1.3.0",
|
|
64
64
|
"eslint-plugin-regexp": "^2.10.0",
|
|
65
65
|
"eslint-plugin-toml": "^0.12.0",
|
|
66
66
|
"eslint-plugin-unicorn": "^61.0.2",
|
|
67
|
-
"eslint-plugin-unused-imports": "^4.
|
|
68
|
-
"eslint-plugin-yml": "^1.
|
|
67
|
+
"eslint-plugin-unused-imports": "^4.3.0",
|
|
68
|
+
"eslint-plugin-yml": "^1.19.0",
|
|
69
69
|
"globals": "^16.4.0",
|
|
70
70
|
"jsonc-eslint-parser": "^2.4.1",
|
|
71
71
|
"local-pkg": "1.1.2",
|
|
@@ -73,20 +73,31 @@
|
|
|
73
73
|
"yaml-eslint-parser": "^1.3.0"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@types/node": "^24.
|
|
77
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
78
|
-
"bumpp": "^10.
|
|
79
|
-
"eslint": "^9.
|
|
80
|
-
"eslint-plugin-better-tailwindcss": "^3.7.
|
|
81
|
-
"eslint-plugin-svelte": "^3.12.
|
|
76
|
+
"@types/node": "^24.9.1",
|
|
77
|
+
"@typescript/native-preview": "7.0.0-dev.20251019.1",
|
|
78
|
+
"bumpp": "^10.3.1",
|
|
79
|
+
"eslint": "^9.38.0",
|
|
80
|
+
"eslint-plugin-better-tailwindcss": "^3.7.10",
|
|
81
|
+
"eslint-plugin-svelte": "^3.12.5",
|
|
82
82
|
"eslint-typegen": "^2.3.0",
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"
|
|
83
|
+
"lint-staged": "^16.2.5",
|
|
84
|
+
"simple-git-hooks": "^2.13.1",
|
|
85
|
+
"svelte": "^5.41.1",
|
|
86
|
+
"svelte-eslint-parser": "^1.4.0",
|
|
87
|
+
"tailwindcss": "^4.1.15",
|
|
88
|
+
"tsdown": "^0.15.9",
|
|
87
89
|
"tsx": "^4.20.6",
|
|
88
90
|
"typescript": "~5.9.3"
|
|
89
91
|
},
|
|
92
|
+
"resolutions": {
|
|
93
|
+
"eslint": "catalog:"
|
|
94
|
+
},
|
|
95
|
+
"simple-git-hooks": {
|
|
96
|
+
"pre-commit": "pnpm exec lint-staged"
|
|
97
|
+
},
|
|
98
|
+
"lint-staged": {
|
|
99
|
+
"*": "eslint --fix"
|
|
100
|
+
},
|
|
90
101
|
"scripts": {
|
|
91
102
|
"build": "pnpm run build:typegen && tsdown --clean",
|
|
92
103
|
"build:typegen": "tsx scripts/typegen.ts",
|