@nijesmik/eslint-config 0.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/index.ts +140 -0
- package/package.json +25 -0
package/index.ts
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import json from "@eslint/json";
|
|
2
|
+
import importPlugin from "eslint-plugin-import";
|
|
3
|
+
import perfectionist from "eslint-plugin-perfectionist";
|
|
4
|
+
import unusedImports from "eslint-plugin-unused-imports";
|
|
5
|
+
import { Alphabet } from "eslint-plugin-perfectionist/alphabet";
|
|
6
|
+
import { defineConfig } from "eslint/config";
|
|
7
|
+
import tseslint from "typescript-eslint";
|
|
8
|
+
|
|
9
|
+
const sortOptions = {
|
|
10
|
+
type: "unsorted",
|
|
11
|
+
groups: ["unknown", "method", "callback"],
|
|
12
|
+
customGroups: [
|
|
13
|
+
{
|
|
14
|
+
type: "unsorted",
|
|
15
|
+
groupName: "callback",
|
|
16
|
+
elementNamePattern: "^on[A-Z]",
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
} as const;
|
|
20
|
+
|
|
21
|
+
export default defineConfig([
|
|
22
|
+
{
|
|
23
|
+
ignores: ["**/*.gen.ts", "**/dist/**"],
|
|
24
|
+
},
|
|
25
|
+
...tseslint.configs.recommended,
|
|
26
|
+
{
|
|
27
|
+
files: ["**/*.{ts,mts,cts,tsx}"],
|
|
28
|
+
languageOptions: {
|
|
29
|
+
parserOptions: {
|
|
30
|
+
tsconfigRootDir: process.cwd(),
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
rules: {
|
|
34
|
+
"@typescript-eslint/no-unused-vars": [
|
|
35
|
+
"error",
|
|
36
|
+
{
|
|
37
|
+
argsIgnorePattern: "^_",
|
|
38
|
+
varsIgnorePattern: "^_",
|
|
39
|
+
caughtErrorsIgnorePattern: "^_",
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
files: ["**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"],
|
|
46
|
+
plugins: { perfectionist, import: importPlugin, "unused-imports": unusedImports },
|
|
47
|
+
rules: {
|
|
48
|
+
"eol-last": ["error", "always"],
|
|
49
|
+
"no-multiple-empty-lines": ["error", { max: 1, maxEOF: 1, maxBOF: 0 }],
|
|
50
|
+
"unused-imports/no-unused-imports": "error",
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
files: ["src/**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"],
|
|
55
|
+
rules: {
|
|
56
|
+
...perfectionist.configs["recommended-alphabetical"].rules,
|
|
57
|
+
"perfectionist/sort-switch-case": "off",
|
|
58
|
+
"perfectionist/sort-classes": "off",
|
|
59
|
+
"perfectionist/sort-interfaces": ["error", sortOptions],
|
|
60
|
+
"perfectionist/sort-modules": "off",
|
|
61
|
+
"perfectionist/sort-jsx-props": "off",
|
|
62
|
+
"perfectionist/sort-exports": [
|
|
63
|
+
"error",
|
|
64
|
+
{
|
|
65
|
+
partitionByNewLine: true,
|
|
66
|
+
groups: ["unknown", "type-export"],
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
"perfectionist/sort-objects": [
|
|
70
|
+
"error",
|
|
71
|
+
{
|
|
72
|
+
type: "unsorted",
|
|
73
|
+
useConfigurationIf: {
|
|
74
|
+
objectType: "non-destructured",
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
"perfectionist/sort-union-types": [
|
|
79
|
+
"error",
|
|
80
|
+
{
|
|
81
|
+
type: "unsorted",
|
|
82
|
+
groups: ["unknown", "nullish"],
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
"perfectionist/sort-object-types": ["error", sortOptions],
|
|
86
|
+
"perfectionist/sort-intersection-types": [
|
|
87
|
+
"error",
|
|
88
|
+
{
|
|
89
|
+
groups: ["named", "unknown"],
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
"perfectionist/sort-imports": [
|
|
93
|
+
"error",
|
|
94
|
+
{
|
|
95
|
+
type: "alphabetical",
|
|
96
|
+
groups: [
|
|
97
|
+
["type-import", "type-internal", "type-parent", "type-sibling", "type-index"],
|
|
98
|
+
["value-builtin", "value-external"],
|
|
99
|
+
"value-internal",
|
|
100
|
+
["value-parent", "value-sibling", "value-index"],
|
|
101
|
+
"ts-equals-import",
|
|
102
|
+
"unknown",
|
|
103
|
+
],
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
"import/no-duplicates": ["error", { "prefer-inline": true }],
|
|
107
|
+
curly: ["error", "all"],
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
files: ["**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"],
|
|
112
|
+
rules: {
|
|
113
|
+
"perfectionist/sort-named-imports": [
|
|
114
|
+
"error",
|
|
115
|
+
{
|
|
116
|
+
type: "custom",
|
|
117
|
+
alphabet: Alphabet.generateRecommendedAlphabet()
|
|
118
|
+
.sortByLocaleCompare("en-US")
|
|
119
|
+
.placeAllWithCaseBeforeAllWithOtherCase("lowercase")
|
|
120
|
+
.getCharacters(),
|
|
121
|
+
ignoreCase: false,
|
|
122
|
+
groups: ["value-import", { newlinesBetween: 0 }, "type-import"],
|
|
123
|
+
},
|
|
124
|
+
],
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
files: ["**/*.json"],
|
|
129
|
+
ignores: ["**/tsconfig.json", "**/tsconfig.*.json"],
|
|
130
|
+
plugins: { json },
|
|
131
|
+
language: "json/json",
|
|
132
|
+
extends: ["json/recommended"],
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
files: ["**/tsconfig.json", "**/tsconfig.*.json"],
|
|
136
|
+
plugins: { json },
|
|
137
|
+
language: "json/jsonc",
|
|
138
|
+
extends: ["json/recommended"],
|
|
139
|
+
},
|
|
140
|
+
]);
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nijesmik/eslint-config",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"exports": {
|
|
6
|
+
".": "./index.ts"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"index.ts"
|
|
10
|
+
],
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@eslint/json": "^0.14.0",
|
|
13
|
+
"eslint-plugin-import": "^2.32.0",
|
|
14
|
+
"eslint-plugin-perfectionist": "^5.4.0",
|
|
15
|
+
"eslint-plugin-unused-imports": "^4.4.1",
|
|
16
|
+
"typescript-eslint": "^8.46.4"
|
|
17
|
+
},
|
|
18
|
+
"peerDependencies": {
|
|
19
|
+
"eslint": ">=9.15.0"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@types/node": "^25.3.0",
|
|
23
|
+
"eslint": "^9.39.1"
|
|
24
|
+
}
|
|
25
|
+
}
|