@dauphaihau/eslint-config 0.0.1
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/dist/index.cjs +40224 -0
- package/dist/index.d.cts +36 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +150 -0
- package/package.json +27 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as _stylistic_eslint_plugin from '@stylistic/eslint-plugin';
|
|
2
|
+
import * as eslint from 'eslint';
|
|
3
|
+
|
|
4
|
+
declare function dauphaihau(): ({
|
|
5
|
+
readonly rules: Readonly<eslint.Linter.RulesRecord>;
|
|
6
|
+
} | {
|
|
7
|
+
name: string;
|
|
8
|
+
plugins: {
|
|
9
|
+
"@stylistic": {
|
|
10
|
+
rules: _stylistic_eslint_plugin.Rules;
|
|
11
|
+
configs: {
|
|
12
|
+
'disable-legacy': eslint.Linter.FlatConfig<eslint.Linter.RulesRecord>;
|
|
13
|
+
customize: typeof _stylistic_eslint_plugin.customize;
|
|
14
|
+
'recommended-flat': eslint.Linter.FlatConfig<eslint.Linter.RulesRecord>;
|
|
15
|
+
'recommended-extends': eslint.Linter.BaseConfig<eslint.Linter.RulesRecord, eslint.Linter.RulesRecord>;
|
|
16
|
+
'all-flat': eslint.Linter.FlatConfig<eslint.Linter.RulesRecord>;
|
|
17
|
+
'all-extends': eslint.Linter.BaseConfig<eslint.Linter.RulesRecord, eslint.Linter.RulesRecord>;
|
|
18
|
+
'recommended-legacy': eslint.Linter.BaseConfig<eslint.Linter.RulesRecord, eslint.Linter.RulesRecord>;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
rules: {
|
|
23
|
+
"@stylistic/semi": string[];
|
|
24
|
+
"@stylistic/quotes": string[];
|
|
25
|
+
"@stylistic/indent": (string | number)[];
|
|
26
|
+
"@stylistic/comma-dangle": string[];
|
|
27
|
+
};
|
|
28
|
+
ignores?: undefined;
|
|
29
|
+
} | {
|
|
30
|
+
ignores: string[];
|
|
31
|
+
name?: undefined;
|
|
32
|
+
plugins?: undefined;
|
|
33
|
+
rules?: undefined;
|
|
34
|
+
})[];
|
|
35
|
+
|
|
36
|
+
export { dauphaihau as default };
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
// src/configs/base.ts
|
|
2
|
+
import js from "@eslint/js";
|
|
3
|
+
import stylistic from "@stylistic/eslint-plugin";
|
|
4
|
+
import ts from "typescript-eslint";
|
|
5
|
+
|
|
6
|
+
// src/utils/ignores.ts
|
|
7
|
+
var defaultIgnores = [
|
|
8
|
+
"**/node_modules/**",
|
|
9
|
+
"**/dist/**",
|
|
10
|
+
"**/coverage/**",
|
|
11
|
+
"**/.next/**",
|
|
12
|
+
"**/.nuxt/**",
|
|
13
|
+
"**/.output/**",
|
|
14
|
+
"**/.vercel/**",
|
|
15
|
+
"**/build/**"
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
// src/configs/base.ts
|
|
19
|
+
function baseConfig(options = {}) {
|
|
20
|
+
const { typescript = false } = options;
|
|
21
|
+
const jsFiles = ["**/*.{js,mjs,cjs,jsx}"];
|
|
22
|
+
const allFiles = typescript ? ["**/*.{js,mjs,cjs,jsx,ts,tsx}"] : jsFiles;
|
|
23
|
+
return [
|
|
24
|
+
// base JavaScript recommended rules
|
|
25
|
+
{
|
|
26
|
+
...js.configs.recommended,
|
|
27
|
+
files: jsFiles
|
|
28
|
+
},
|
|
29
|
+
// stylistic (formatting) rules
|
|
30
|
+
{
|
|
31
|
+
name: "dauphaihau/stylistic",
|
|
32
|
+
files: allFiles,
|
|
33
|
+
...typescript && {
|
|
34
|
+
languageOptions: {
|
|
35
|
+
parser: ts.parser
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
plugins: { "@stylistic": stylistic },
|
|
39
|
+
rules: {
|
|
40
|
+
// Spacing
|
|
41
|
+
"@stylistic/func-call-spacing": "error",
|
|
42
|
+
"@stylistic/space-before-function-paren": ["error", {
|
|
43
|
+
anonymous: "always",
|
|
44
|
+
named: "never",
|
|
45
|
+
asyncArrow: "always"
|
|
46
|
+
}],
|
|
47
|
+
"@stylistic/space-in-parens": ["error", "never"],
|
|
48
|
+
"@stylistic/no-mixed-spaces-and-tabs": "error",
|
|
49
|
+
"@stylistic/object-curly-spacing": ["error", "always"],
|
|
50
|
+
"@stylistic/no-whitespace-before-property": "error",
|
|
51
|
+
"@stylistic/no-multi-spaces": "error",
|
|
52
|
+
"@stylistic/type-generic-spacing": "error",
|
|
53
|
+
// '@stylistic/type-named-tuple-spacing ': 'error',
|
|
54
|
+
// Semi
|
|
55
|
+
"@stylistic/semi": [
|
|
56
|
+
"error",
|
|
57
|
+
"always",
|
|
58
|
+
{
|
|
59
|
+
omitLastInOneLineBlock: true,
|
|
60
|
+
omitLastInOneLineClassBody: true
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
// Indent
|
|
64
|
+
"@stylistic/indent": ["error", 2, { SwitchCase: 1 }],
|
|
65
|
+
// Commas
|
|
66
|
+
"@stylistic/comma-dangle": ["error", {
|
|
67
|
+
arrays: "always-multiline",
|
|
68
|
+
objects: "always-multiline",
|
|
69
|
+
imports: "never",
|
|
70
|
+
exports: "never",
|
|
71
|
+
functions: "never"
|
|
72
|
+
}],
|
|
73
|
+
// Line breaks
|
|
74
|
+
"@stylistic/object-curly-newline": ["error", {
|
|
75
|
+
multiline: true,
|
|
76
|
+
minProperties: 4,
|
|
77
|
+
consistent: true
|
|
78
|
+
}],
|
|
79
|
+
"@stylistic/object-property-newline": ["error", { allowAllPropertiesOnSameLine: true }],
|
|
80
|
+
// Quotes
|
|
81
|
+
"@stylistic/quotes": ["error", "single"],
|
|
82
|
+
"@stylistic/quote-props": ["error", "as-needed"],
|
|
83
|
+
// Brackets
|
|
84
|
+
"@stylistic/new-parens": "error",
|
|
85
|
+
"@stylistic/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
|
|
86
|
+
// Operators
|
|
87
|
+
"@stylistic/multiline-ternary": ["error", "always-multiline"],
|
|
88
|
+
"@stylistic/no-mixed-operators": "error",
|
|
89
|
+
"@stylistic/operator-linebreak": ["error", "after"],
|
|
90
|
+
"@stylistic/dot-location": ["error", "property"],
|
|
91
|
+
// Disallow
|
|
92
|
+
"@stylistic/no-multiple-empty-lines": ["error", { max: 2, maxEOF: 0 }],
|
|
93
|
+
"@stylistic/no-floating-decimal": "error",
|
|
94
|
+
"@stylistic/no-tabs": "off",
|
|
95
|
+
// Misc
|
|
96
|
+
"@stylistic/max-statements-per-line": ["error", { max: 1 }],
|
|
97
|
+
"@stylistic/one-var-declaration-per-line": ["error", "initializations"]
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
// ignore common folders
|
|
101
|
+
{
|
|
102
|
+
name: "dauphaihau/ignores",
|
|
103
|
+
ignores: defaultIgnores
|
|
104
|
+
}
|
|
105
|
+
];
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// src/configs/typescript.ts
|
|
109
|
+
import ts2 from "typescript-eslint";
|
|
110
|
+
function typescriptConfig() {
|
|
111
|
+
return [
|
|
112
|
+
// Recommended TS rules (no type-checking) – fast preset
|
|
113
|
+
...ts2.configs.recommended,
|
|
114
|
+
// If you want type-aware rules later, you can push:
|
|
115
|
+
// ...tseslint.configs.recommendedTypeChecked,
|
|
116
|
+
// and add `languageOptions: { parserOptions: { projectService: true } }` with a tsconfig, etc.
|
|
117
|
+
// Narrow the files to TS/TSX only for TS-specific rules if you add custom ones later:
|
|
118
|
+
{
|
|
119
|
+
files: ["**/*.ts", "**/*.tsx"],
|
|
120
|
+
languageOptions: {
|
|
121
|
+
parser: ts2.parser
|
|
122
|
+
},
|
|
123
|
+
rules: {
|
|
124
|
+
"@typescript-eslint/no-import-type-side-effects": "error",
|
|
125
|
+
"@typescript-eslint/no-unused-vars": ["error", {
|
|
126
|
+
varsIgnorePattern: "^_",
|
|
127
|
+
argsIgnorePattern: "^_",
|
|
128
|
+
ignoreRestSiblings: true
|
|
129
|
+
}],
|
|
130
|
+
"@typescript-eslint/no-shadow": "error",
|
|
131
|
+
"@typescript-eslint/consistent-type-imports": "error"
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
];
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// src/index.ts
|
|
138
|
+
function dauphaihau(options = {}) {
|
|
139
|
+
const { typescript } = options;
|
|
140
|
+
const configs = [
|
|
141
|
+
...baseConfig({ typescript })
|
|
142
|
+
];
|
|
143
|
+
if (typescript) {
|
|
144
|
+
configs.push(...typescriptConfig());
|
|
145
|
+
}
|
|
146
|
+
return configs;
|
|
147
|
+
}
|
|
148
|
+
export {
|
|
149
|
+
dauphaihau as default
|
|
150
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dauphaihau/eslint-config",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": ["dist"],
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "pnpm exec tsup src/index.ts --dts --format esm --external @eslint/js --external @stylistic/eslint-plugin --external typescript-eslint",
|
|
10
|
+
"lint": "eslint ."
|
|
11
|
+
},
|
|
12
|
+
"peerDependencies": {
|
|
13
|
+
"eslint": "^9.0.0"
|
|
14
|
+
},
|
|
15
|
+
"peerDependenciesMeta": {
|
|
16
|
+
"typescript": { "optional": true },
|
|
17
|
+
"typescript-eslint": { "optional": true }
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"typescript": "^5.4.0",
|
|
21
|
+
"typescript-eslint": "^8.0.0",
|
|
22
|
+
"tsup": "^8.0.0",
|
|
23
|
+
"eslint": "^9.0.0",
|
|
24
|
+
"@eslint/js": "^9.0.0",
|
|
25
|
+
"@stylistic/eslint-plugin": "^1.6.0"
|
|
26
|
+
}
|
|
27
|
+
}
|