@nonitomo/eslint 0.0.0-stage → 0.0.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 +17 -2
- package/dist/cjs/index.cjs +134 -0
- package/dist/cjs/index.d.cts +8 -0
- package/dist/esm/index.d.mts +8 -0
- package/dist/esm/index.mjs +111 -0
- package/package.json +60 -3
package/README.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 🪄 eslint
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## Installation
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install --save-dev @nonitomo/eslint
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
import { eslint } from "@nonitomo/eslint";
|
|
13
|
+
|
|
14
|
+
export default eslint({
|
|
15
|
+
typescript: true
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
```
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
// \0rolldown/runtime.js
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
|
+
get: ((k) => from[k]).bind(null, key),
|
|
14
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
20
|
+
value: mod,
|
|
21
|
+
enumerable: true
|
|
22
|
+
}) : target, mod));
|
|
23
|
+
let _antfu_eslint_config = require("@antfu/eslint-config");
|
|
24
|
+
_antfu_eslint_config = __toESM(_antfu_eslint_config, 1);
|
|
25
|
+
// src/index.ts
|
|
26
|
+
const eslint = async (inputOptions = {}, ...configs) => {
|
|
27
|
+
const { typescript = false, ...options } = inputOptions;
|
|
28
|
+
return (0, _antfu_eslint_config.default)({
|
|
29
|
+
...options,
|
|
30
|
+
...typescript === "engine" ? { typescript: { tsconfigPath: "./tsconfig.json" } } : { typescript }
|
|
31
|
+
}, {
|
|
32
|
+
name: "nonitomo/rewrite",
|
|
33
|
+
files: ["**/*.?([cm])[jt]s?(x)"],
|
|
34
|
+
rules: {
|
|
35
|
+
"antfu/if-newline": "off",
|
|
36
|
+
"antfu/top-level-function": "off",
|
|
37
|
+
"no-console": "warn",
|
|
38
|
+
"prefer-template": "error",
|
|
39
|
+
"arrow-body-style": ["error", "as-needed"],
|
|
40
|
+
"unicorn/no-typeof-undefined": "error",
|
|
41
|
+
"unicorn/no-useless-spread": "warn",
|
|
42
|
+
"e18e/prefer-static-regex": "off",
|
|
43
|
+
"e18e/prefer-array-at": "off",
|
|
44
|
+
"import/newline-after-import": "error",
|
|
45
|
+
"react/prefer-namespace-import": "off",
|
|
46
|
+
"react-hooks/exhaustive-deps": "off",
|
|
47
|
+
"react-refresh/only-export-components": "off",
|
|
48
|
+
"test/prefer-lowercase-title": "off"
|
|
49
|
+
}
|
|
50
|
+
}, {
|
|
51
|
+
name: "nonitomo/sort",
|
|
52
|
+
rules: {
|
|
53
|
+
"perfectionist/sort-array-includes": ["error", {
|
|
54
|
+
order: "asc",
|
|
55
|
+
type: "alphabetical"
|
|
56
|
+
}],
|
|
57
|
+
"perfectionist/sort-imports": ["error", {
|
|
58
|
+
groups: [
|
|
59
|
+
"type-import",
|
|
60
|
+
["value-builtin", "value-external"],
|
|
61
|
+
"type-internal",
|
|
62
|
+
"value-internal",
|
|
63
|
+
[
|
|
64
|
+
"type-parent",
|
|
65
|
+
"type-sibling",
|
|
66
|
+
"type-index"
|
|
67
|
+
],
|
|
68
|
+
[
|
|
69
|
+
"value-parent",
|
|
70
|
+
"value-sibling",
|
|
71
|
+
"value-index"
|
|
72
|
+
],
|
|
73
|
+
"style",
|
|
74
|
+
"side-effect",
|
|
75
|
+
"side-effect-style",
|
|
76
|
+
"ts-equals-import",
|
|
77
|
+
"unknown"
|
|
78
|
+
],
|
|
79
|
+
internalPattern: ["^~/.+", "^@/.+"],
|
|
80
|
+
newlinesBetween: 1,
|
|
81
|
+
order: "asc",
|
|
82
|
+
type: "natural"
|
|
83
|
+
}],
|
|
84
|
+
"perfectionist/sort-interfaces": ["error", {
|
|
85
|
+
groups: [
|
|
86
|
+
"property",
|
|
87
|
+
"member",
|
|
88
|
+
"method",
|
|
89
|
+
"index-signature"
|
|
90
|
+
],
|
|
91
|
+
order: "asc",
|
|
92
|
+
type: "alphabetical"
|
|
93
|
+
}],
|
|
94
|
+
"perfectionist/sort-jsx-props": ["error", {
|
|
95
|
+
customGroups: [{
|
|
96
|
+
groupName: "reserved",
|
|
97
|
+
elementNamePattern: "^(key|ref)$"
|
|
98
|
+
}, {
|
|
99
|
+
groupName: "callback",
|
|
100
|
+
elementNamePattern: "^on[A-Z].*"
|
|
101
|
+
}],
|
|
102
|
+
groups: [
|
|
103
|
+
"shorthand-prop",
|
|
104
|
+
"reserved",
|
|
105
|
+
"multiline-prop",
|
|
106
|
+
"unknown",
|
|
107
|
+
"callback"
|
|
108
|
+
],
|
|
109
|
+
order: "asc",
|
|
110
|
+
type: "alphabetical"
|
|
111
|
+
}],
|
|
112
|
+
"perfectionist/sort-union-types": ["error", {
|
|
113
|
+
groups: [
|
|
114
|
+
"conditional",
|
|
115
|
+
"function",
|
|
116
|
+
"import",
|
|
117
|
+
"intersection",
|
|
118
|
+
"keyword",
|
|
119
|
+
"literal",
|
|
120
|
+
"named",
|
|
121
|
+
"object",
|
|
122
|
+
"operator",
|
|
123
|
+
"tuple",
|
|
124
|
+
"union",
|
|
125
|
+
"nullish"
|
|
126
|
+
],
|
|
127
|
+
order: "asc",
|
|
128
|
+
specialCharacters: "keep",
|
|
129
|
+
type: "alphabetical"
|
|
130
|
+
}]
|
|
131
|
+
}
|
|
132
|
+
}, ...configs);
|
|
133
|
+
};
|
|
134
|
+
exports.eslint = eslint;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Awaitable, OptionsConfig, OptionsTypescript, TypedFlatConfigItem } from "@antfu/eslint-config";
|
|
2
|
+
import { Linter } from "eslint";
|
|
3
|
+
type EslintOptions = OptionsConfig & TypedFlatConfigItem & {
|
|
4
|
+
typescript?: boolean | 'engine' | OptionsTypescript;
|
|
5
|
+
};
|
|
6
|
+
type Eslint = (options?: EslintOptions, ...userConfigs: Awaitable<Linter.Config[] | TypedFlatConfigItem | TypedFlatConfigItem[]>[]) => Promise<Linter.Config[]>;
|
|
7
|
+
declare const eslint: Eslint;
|
|
8
|
+
export { eslint };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Awaitable, OptionsConfig, OptionsTypescript, TypedFlatConfigItem } from "@antfu/eslint-config";
|
|
2
|
+
import { Linter } from "eslint";
|
|
3
|
+
type EslintOptions = OptionsConfig & TypedFlatConfigItem & {
|
|
4
|
+
typescript?: boolean | 'engine' | OptionsTypescript;
|
|
5
|
+
};
|
|
6
|
+
type Eslint = (options?: EslintOptions, ...userConfigs: Awaitable<Linter.Config[] | TypedFlatConfigItem | TypedFlatConfigItem[]>[]) => Promise<Linter.Config[]>;
|
|
7
|
+
declare const eslint: Eslint;
|
|
8
|
+
export { eslint };
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import antfu from "@antfu/eslint-config";
|
|
2
|
+
// src/index.ts
|
|
3
|
+
const eslint = async (inputOptions = {}, ...configs) => {
|
|
4
|
+
const { typescript = false, ...options } = inputOptions;
|
|
5
|
+
return antfu({
|
|
6
|
+
...options,
|
|
7
|
+
...typescript === "engine" ? { typescript: { tsconfigPath: "./tsconfig.json" } } : { typescript }
|
|
8
|
+
}, {
|
|
9
|
+
name: "nonitomo/rewrite",
|
|
10
|
+
files: ["**/*.?([cm])[jt]s?(x)"],
|
|
11
|
+
rules: {
|
|
12
|
+
"antfu/if-newline": "off",
|
|
13
|
+
"antfu/top-level-function": "off",
|
|
14
|
+
"no-console": "warn",
|
|
15
|
+
"prefer-template": "error",
|
|
16
|
+
"arrow-body-style": ["error", "as-needed"],
|
|
17
|
+
"unicorn/no-typeof-undefined": "error",
|
|
18
|
+
"unicorn/no-useless-spread": "warn",
|
|
19
|
+
"e18e/prefer-static-regex": "off",
|
|
20
|
+
"e18e/prefer-array-at": "off",
|
|
21
|
+
"import/newline-after-import": "error",
|
|
22
|
+
"react/prefer-namespace-import": "off",
|
|
23
|
+
"react-hooks/exhaustive-deps": "off",
|
|
24
|
+
"react-refresh/only-export-components": "off",
|
|
25
|
+
"test/prefer-lowercase-title": "off"
|
|
26
|
+
}
|
|
27
|
+
}, {
|
|
28
|
+
name: "nonitomo/sort",
|
|
29
|
+
rules: {
|
|
30
|
+
"perfectionist/sort-array-includes": ["error", {
|
|
31
|
+
order: "asc",
|
|
32
|
+
type: "alphabetical"
|
|
33
|
+
}],
|
|
34
|
+
"perfectionist/sort-imports": ["error", {
|
|
35
|
+
groups: [
|
|
36
|
+
"type-import",
|
|
37
|
+
["value-builtin", "value-external"],
|
|
38
|
+
"type-internal",
|
|
39
|
+
"value-internal",
|
|
40
|
+
[
|
|
41
|
+
"type-parent",
|
|
42
|
+
"type-sibling",
|
|
43
|
+
"type-index"
|
|
44
|
+
],
|
|
45
|
+
[
|
|
46
|
+
"value-parent",
|
|
47
|
+
"value-sibling",
|
|
48
|
+
"value-index"
|
|
49
|
+
],
|
|
50
|
+
"style",
|
|
51
|
+
"side-effect",
|
|
52
|
+
"side-effect-style",
|
|
53
|
+
"ts-equals-import",
|
|
54
|
+
"unknown"
|
|
55
|
+
],
|
|
56
|
+
internalPattern: ["^~/.+", "^@/.+"],
|
|
57
|
+
newlinesBetween: 1,
|
|
58
|
+
order: "asc",
|
|
59
|
+
type: "natural"
|
|
60
|
+
}],
|
|
61
|
+
"perfectionist/sort-interfaces": ["error", {
|
|
62
|
+
groups: [
|
|
63
|
+
"property",
|
|
64
|
+
"member",
|
|
65
|
+
"method",
|
|
66
|
+
"index-signature"
|
|
67
|
+
],
|
|
68
|
+
order: "asc",
|
|
69
|
+
type: "alphabetical"
|
|
70
|
+
}],
|
|
71
|
+
"perfectionist/sort-jsx-props": ["error", {
|
|
72
|
+
customGroups: [{
|
|
73
|
+
groupName: "reserved",
|
|
74
|
+
elementNamePattern: "^(key|ref)$"
|
|
75
|
+
}, {
|
|
76
|
+
groupName: "callback",
|
|
77
|
+
elementNamePattern: "^on[A-Z].*"
|
|
78
|
+
}],
|
|
79
|
+
groups: [
|
|
80
|
+
"shorthand-prop",
|
|
81
|
+
"reserved",
|
|
82
|
+
"multiline-prop",
|
|
83
|
+
"unknown",
|
|
84
|
+
"callback"
|
|
85
|
+
],
|
|
86
|
+
order: "asc",
|
|
87
|
+
type: "alphabetical"
|
|
88
|
+
}],
|
|
89
|
+
"perfectionist/sort-union-types": ["error", {
|
|
90
|
+
groups: [
|
|
91
|
+
"conditional",
|
|
92
|
+
"function",
|
|
93
|
+
"import",
|
|
94
|
+
"intersection",
|
|
95
|
+
"keyword",
|
|
96
|
+
"literal",
|
|
97
|
+
"named",
|
|
98
|
+
"object",
|
|
99
|
+
"operator",
|
|
100
|
+
"tuple",
|
|
101
|
+
"union",
|
|
102
|
+
"nullish"
|
|
103
|
+
],
|
|
104
|
+
order: "asc",
|
|
105
|
+
specialCharacters: "keep",
|
|
106
|
+
type: "alphabetical"
|
|
107
|
+
}]
|
|
108
|
+
}
|
|
109
|
+
}, ...configs);
|
|
110
|
+
};
|
|
111
|
+
export { eslint };
|
package/package.json
CHANGED
|
@@ -1,6 +1,63 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nonitomo/eslint",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.0.2",
|
|
5
|
+
"description": "eslint config",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "NoniTomo",
|
|
8
|
+
"url": "https://github.com/NoniTomo/hub"
|
|
9
|
+
},
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"repository": {
|
|
12
|
+
"url": "https://github.com/NoniTomo/hub"
|
|
13
|
+
},
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/NoniTomo/hub/issues"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"eslint",
|
|
19
|
+
"formatter"
|
|
20
|
+
],
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"import": {
|
|
24
|
+
"types": "./dist/esm/index.d.mts",
|
|
25
|
+
"default": "./dist/esm/index.mjs"
|
|
26
|
+
},
|
|
27
|
+
"require": {
|
|
28
|
+
"types": "./dist/esm/index.d.mts",
|
|
29
|
+
"default": "./dist/esm/index.mjs"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"main": "dist/cjs/index.cjs",
|
|
34
|
+
"module": "dist/esm/index.mjs",
|
|
35
|
+
"types": "dist/esm/index.d.mts",
|
|
36
|
+
"files": [
|
|
37
|
+
"dist"
|
|
38
|
+
],
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@antfu/eslint-config": "10.0.0",
|
|
44
|
+
"@eslint-react/eslint-plugin": "5.28.8",
|
|
45
|
+
"@vue/compiler-sfc": "3.5.45",
|
|
46
|
+
"eslint": "10.14.0",
|
|
47
|
+
"eslint-flat-config-utils": "3.2.0",
|
|
48
|
+
"oxfmt": "^0.78.0"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@nonitomo/eslint": "0.0.2",
|
|
52
|
+
"@nonitomo/oxfmt": "0.0.2",
|
|
53
|
+
"@nonitomo/tsconfig": "0.0.2"
|
|
54
|
+
},
|
|
55
|
+
"scripts": {
|
|
56
|
+
"build": "tsdown",
|
|
57
|
+
"lint": "eslint . --fix",
|
|
58
|
+
"lint-inspector": "npx @eslint/config-inspector",
|
|
59
|
+
"type": "tsc --noEmit",
|
|
60
|
+
"format": "oxfmt",
|
|
61
|
+
"pretty": "pnpm type && pnpm lint && pnpm format"
|
|
62
|
+
}
|
|
6
63
|
}
|