@tommy-mitchell/eslint-config-xo 0.3.0 → 0.4.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/dprint.js +12 -0
- package/index.js +15 -25
- package/package.json +26 -20
- package/react.js +6 -9
- package/readme.md +17 -3
- package/tailwind.js +10 -1
- package/helpers.js +0 -118
package/dprint.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
extends: ["plugin:dprint-integration/disable-conflict"],
|
|
5
|
+
overrides: [{
|
|
6
|
+
files: "**/*.{ts,cts,mts,tsx}",
|
|
7
|
+
rules: {
|
|
8
|
+
"@typescript-eslint/object-curly-spacing": "off",
|
|
9
|
+
"@typescript-eslint/space-infix-ops": "off",
|
|
10
|
+
},
|
|
11
|
+
}],
|
|
12
|
+
};
|
package/index.js
CHANGED
|
@@ -1,43 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const { importOrder, preventAbbreviations } = require("./helpers.js");
|
|
3
2
|
|
|
4
3
|
module.exports = {
|
|
5
|
-
|
|
4
|
+
plugins: ["simple-import-sort"],
|
|
6
5
|
rules: {
|
|
7
|
-
|
|
8
|
-
"
|
|
6
|
+
// https://github.com/xojs/eslint-config-xo/blob/v0.44.0/index.js#L304
|
|
7
|
+
"capitalized-comments": "off",
|
|
9
8
|
// https://github.com/xojs/eslint-config-xo/blob/v0.44.0/index.js#L186
|
|
10
9
|
"no-warning-comments": ["warn", { decoration: ["/", "*"] }],
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
"object-shorthand": "off",
|
|
11
|
+
"import/extensions": "off",
|
|
12
|
+
"import/order": "off",
|
|
13
|
+
// "n/file-extension-in-import": ["error", "always"],
|
|
14
|
+
"simple-import-sort/imports": ["error", {
|
|
15
|
+
groups: [["^\\u0000", "^node:", "^react", "^react-dom", "^@?\\w", "^", "^\\."]],
|
|
16
16
|
}],
|
|
17
|
-
"import/
|
|
18
|
-
"unicorn/
|
|
19
|
-
|
|
20
|
-
preventAbbreviations({
|
|
21
|
-
pkg: false,
|
|
22
|
-
args: false,
|
|
23
|
-
req: false,
|
|
24
|
-
res: false,
|
|
25
|
-
props: false,
|
|
26
|
-
ref: false,
|
|
27
|
-
}),
|
|
28
|
-
],
|
|
17
|
+
"simple-import-sort/exports": "error",
|
|
18
|
+
"unicorn/prefer-regexp-test": "off",
|
|
19
|
+
"unicorn/prevent-abbreviations": "off",
|
|
29
20
|
},
|
|
30
21
|
overrides: [{
|
|
31
22
|
files: "**/*.{ts,cts,mts,tsx}",
|
|
23
|
+
settings: {
|
|
24
|
+
n: { typescriptExtensionMap: [[".ts", ".ts"]] },
|
|
25
|
+
},
|
|
32
26
|
rules: {
|
|
33
|
-
"@typescript-eslint/object-curly-spacing": "off",
|
|
34
27
|
// https://github.com/xojs/eslint-config-xo-typescript/blob/v2.0.0/index.js#L384
|
|
35
28
|
"@typescript-eslint/no-confusing-void-expression": ["error", { ignoreArrowShorthand: true }],
|
|
36
|
-
"n/file-extension-in-import": ["error", "always", { ".ts": "always", ".tsx": "always" }],
|
|
37
29
|
// https://github.com/xojs/eslint-config-xo-typescript/blob/v2.0.0/index.js#L707
|
|
38
30
|
"@typescript-eslint/prefer-regexp-exec": "off",
|
|
39
|
-
// Conflicts with dprint
|
|
40
|
-
"@typescript-eslint/space-infix-ops": "off",
|
|
41
31
|
},
|
|
42
32
|
}],
|
|
43
33
|
};
|
package/package.json
CHANGED
|
@@ -1,31 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tommy-mitchell/eslint-config-xo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Personal config for XO.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nodejs",
|
|
7
7
|
"config",
|
|
8
8
|
"xo"
|
|
9
9
|
],
|
|
10
|
-
"license": "MIT",
|
|
11
10
|
"repository": "tommy-mitchell/eslint-config-xo",
|
|
11
|
+
"license": "MIT",
|
|
12
12
|
"author": {
|
|
13
13
|
"name": "Tommy Mitchell",
|
|
14
14
|
"url": "https://tommymitchell.io"
|
|
15
15
|
},
|
|
16
16
|
"sideEffects": false,
|
|
17
17
|
"files": [
|
|
18
|
+
"dprint.js",
|
|
18
19
|
"index.js",
|
|
19
20
|
"react.js",
|
|
20
|
-
"tailwind.js"
|
|
21
|
-
"helpers.js"
|
|
21
|
+
"tailwind.js"
|
|
22
22
|
],
|
|
23
|
-
"engines": {
|
|
24
|
-
"node": ">=18"
|
|
25
|
-
},
|
|
26
23
|
"scripts": {
|
|
24
|
+
"format": "dprint fmt && xo --fix",
|
|
27
25
|
"lint": "xo",
|
|
28
|
-
"
|
|
26
|
+
"test": "ava"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"eslint-config-xo-react": "^0.27.0",
|
|
30
|
+
"eslint-plugin-dprint-integration": "^0.3.0",
|
|
31
|
+
"eslint-plugin-jsx-a11y": "^6.9.0",
|
|
32
|
+
"eslint-plugin-react": "^7.35.0",
|
|
33
|
+
"eslint-plugin-react-hooks": "^4.6.2",
|
|
34
|
+
"eslint-plugin-react-refresh": "^0.4.9",
|
|
35
|
+
"eslint-plugin-readable-tailwind": "^1.5.3",
|
|
36
|
+
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
37
|
+
"eslint-plugin-tailwindcss": "^3.17.4"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@tommy-mitchell/dprint-config": "^0.2.0",
|
|
41
|
+
"ava": "^6.1.3",
|
|
42
|
+
"dprint": "0.x",
|
|
43
|
+
"execa": "^9.3.0",
|
|
44
|
+
"xo": "0.x"
|
|
29
45
|
},
|
|
30
46
|
"peerDependencies": {
|
|
31
47
|
"dprint": "0.x",
|
|
@@ -44,17 +60,7 @@
|
|
|
44
60
|
"optional": true
|
|
45
61
|
}
|
|
46
62
|
},
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"eslint-config-xo-react": "^0.27.0",
|
|
50
|
-
"eslint-plugin-jsx-a11y": "^6.8.0",
|
|
51
|
-
"eslint-plugin-react": "^7.33.2",
|
|
52
|
-
"eslint-plugin-react-hooks": "^4.6.0",
|
|
53
|
-
"eslint-plugin-tailwindcss": "^3.14.3"
|
|
54
|
-
},
|
|
55
|
-
"devDependencies": {
|
|
56
|
-
"@tommy-mitchell/dprint-config": "^0.1.1",
|
|
57
|
-
"dprint": "0.x",
|
|
58
|
-
"xo": "0.x"
|
|
63
|
+
"engines": {
|
|
64
|
+
"node": "^18.18 || ^20.8 || >=21"
|
|
59
65
|
}
|
|
60
66
|
}
|
package/react.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const { importOrder } = require("./helpers.js");
|
|
3
2
|
|
|
4
3
|
module.exports = {
|
|
5
4
|
extends: [
|
|
6
5
|
"xo-react",
|
|
6
|
+
"plugin:react/jsx-runtime",
|
|
7
7
|
"plugin:jsx-a11y/recommended",
|
|
8
8
|
],
|
|
9
|
+
plugins: ["react-refresh"],
|
|
9
10
|
rules: {
|
|
10
11
|
"react/no-array-index-key": "warn",
|
|
12
|
+
"react-refresh/only-export-components": ["warn", {
|
|
13
|
+
allowConstantExport: true,
|
|
14
|
+
}],
|
|
11
15
|
"unicorn/filename-case": ["error", {
|
|
12
16
|
cases: {
|
|
13
17
|
camelCase: true,
|
|
@@ -15,16 +19,9 @@ module.exports = {
|
|
|
15
19
|
pascalCase: true,
|
|
16
20
|
},
|
|
17
21
|
}],
|
|
18
|
-
"import/order": ["error", {
|
|
19
|
-
...importOrder,
|
|
20
|
-
pathGroups: [{
|
|
21
|
-
pattern: "@{assets|constants|components|content|providers|helpers|hooks|utils}/**",
|
|
22
|
-
group: "internal",
|
|
23
|
-
}],
|
|
24
|
-
}],
|
|
25
22
|
},
|
|
26
23
|
overrides: [{
|
|
27
|
-
files: "src/constants/**/*.{ts,cts,mts,tsx}",
|
|
24
|
+
files: ["src/constants/**/*.{ts,cts,mts,tsx}", "**/constants.{ts,cts,mts,tsx}"],
|
|
28
25
|
rules: {
|
|
29
26
|
"@typescript-eslint/naming-convention": "off",
|
|
30
27
|
},
|
package/readme.md
CHANGED
|
@@ -10,19 +10,21 @@ npm install --save-dev @tommy-mitchell/eslint-config-xo xo @tommy-mitchell/dprin
|
|
|
10
10
|
|
|
11
11
|
<details>
|
|
12
12
|
<summary>Other Package Managers</summary>
|
|
13
|
-
|
|
14
|
-
<br />
|
|
13
|
+
<p>
|
|
15
14
|
|
|
16
15
|
```sh
|
|
17
16
|
yarn add --dev @tommy-mitchell/eslint-config-xo xo @tommy-mitchell/dprint-config dprint
|
|
18
17
|
```
|
|
19
18
|
|
|
19
|
+
</p>
|
|
20
20
|
</details>
|
|
21
21
|
|
|
22
22
|
### Peer Dependencies
|
|
23
23
|
|
|
24
24
|
- [xo](https://github.com/xojs/xo) - JavaScript/TypeScript linter (ESLint wrapper) with great defaults.
|
|
25
|
-
- [dprint](https://github.com/dprint/dprint) - Pluggable and configurable code formatting platform written in Rust.
|
|
25
|
+
- [dprint](https://github.com/dprint/dprint) (*Optional*) - Pluggable and configurable code formatting platform written in Rust.
|
|
26
|
+
- [react](https://react.dev) (*Optional*) - The library for web and native user interfaces.
|
|
27
|
+
- [tailwindcss](https://tailwindcss.com) (*Optional*) - A utility-first CSS framework for rapid UI development.
|
|
26
28
|
|
|
27
29
|
## Usage
|
|
28
30
|
|
|
@@ -32,12 +34,24 @@ Add to the `extends` section of your `XO` config:
|
|
|
32
34
|
"extends": ["@tommy-mitchell/xo"],
|
|
33
35
|
```
|
|
34
36
|
|
|
37
|
+
### dprint
|
|
38
|
+
|
|
39
|
+
```jsonc
|
|
40
|
+
"extends": ["@tommy-mitchell/xo", "@tommy-mitchell/xo/dprint"],
|
|
41
|
+
```
|
|
42
|
+
|
|
35
43
|
### React
|
|
36
44
|
|
|
37
45
|
```jsonc
|
|
38
46
|
"extends": ["@tommy-mitchell/xo", "@tommy-mitchell/xo/react"],
|
|
39
47
|
```
|
|
40
48
|
|
|
49
|
+
#### React + dprint
|
|
50
|
+
|
|
51
|
+
```jsonc
|
|
52
|
+
"extends": ["@tommy-mitchell/xo", "@tommy-mitchell/xo/react", "@tommy-mitchell/xo/dprint"],
|
|
53
|
+
```
|
|
54
|
+
|
|
41
55
|
### Tailwind CSS
|
|
42
56
|
|
|
43
57
|
```jsonc
|
package/tailwind.js
CHANGED
|
@@ -2,9 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
module.exports = {
|
|
4
4
|
extends: ["plugin:tailwindcss/recommended"],
|
|
5
|
+
plugins: ["readable-tailwind"],
|
|
5
6
|
rules: {
|
|
7
|
+
"readable-tailwind/multiline": ["warn", {
|
|
8
|
+
group: "newLine",
|
|
9
|
+
indent: "tab",
|
|
10
|
+
printWidth: 120,
|
|
11
|
+
}],
|
|
12
|
+
"readable-tailwind/no-unnecessary-whitespace": "warn",
|
|
13
|
+
"readable-tailwind/sort-classes": "warn",
|
|
14
|
+
"tailwindcss/classnames-order": "off",
|
|
6
15
|
"tailwindcss/no-custom-classname": ["warn", {
|
|
7
|
-
callees: ["classnames", "clsx", "ctl", "cva", "tv", "cn", "cnx"],
|
|
16
|
+
callees: ["classnames", "clsx", "ctl", "cva", "tv", "tva", "tw", "twMerge", "cn", "cnx"],
|
|
8
17
|
}],
|
|
9
18
|
},
|
|
10
19
|
};
|
package/helpers.js
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.importOrder = {
|
|
4
|
-
"groups": [
|
|
5
|
-
"builtin",
|
|
6
|
-
"external",
|
|
7
|
-
"parent",
|
|
8
|
-
"sibling",
|
|
9
|
-
"index",
|
|
10
|
-
],
|
|
11
|
-
"newlines-between": "never",
|
|
12
|
-
"warnOnUnassignedImports": true,
|
|
13
|
-
"distinctGroup": true,
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
// Defaults from https://github.com/xojs/xo/blob/v0.57.0/config/plugins.cjs#L38
|
|
17
|
-
exports.preventAbbreviations = (extras) => ({
|
|
18
|
-
checkFilenames: false,
|
|
19
|
-
checkDefaultAndNamespaceImports: false,
|
|
20
|
-
checkShorthandImports: false,
|
|
21
|
-
extendDefaultReplacements: true,
|
|
22
|
-
replacements: {
|
|
23
|
-
// https://thenextweb.com/dd/2020/07/13/linux-kernel-will-no-longer-use-terms-blacklist-and-slave/
|
|
24
|
-
whitelist: {
|
|
25
|
-
include: true,
|
|
26
|
-
},
|
|
27
|
-
blacklist: {
|
|
28
|
-
exclude: true,
|
|
29
|
-
},
|
|
30
|
-
master: {
|
|
31
|
-
main: true,
|
|
32
|
-
},
|
|
33
|
-
slave: {
|
|
34
|
-
secondary: true,
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
// Reverse.
|
|
38
|
-
application: {
|
|
39
|
-
app: true,
|
|
40
|
-
},
|
|
41
|
-
applications: {
|
|
42
|
-
apps: true,
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
// Disable some that may be too annoying.
|
|
46
|
-
env: false,
|
|
47
|
-
i: false, // Do it at some point, but not ready for it yet. Maybe 2025.
|
|
48
|
-
|
|
49
|
-
// Not part of `eslint-plugin-unicorn`. Upstream them at some point.
|
|
50
|
-
bin: {
|
|
51
|
-
binary: true,
|
|
52
|
-
},
|
|
53
|
-
eof: {
|
|
54
|
-
endOfFile: true,
|
|
55
|
-
},
|
|
56
|
-
impl: {
|
|
57
|
-
implement: true,
|
|
58
|
-
implementation: true,
|
|
59
|
-
},
|
|
60
|
-
anim: {
|
|
61
|
-
animation: true,
|
|
62
|
-
},
|
|
63
|
-
calc: {
|
|
64
|
-
calculate: true,
|
|
65
|
-
},
|
|
66
|
-
dict: {
|
|
67
|
-
dictionary: true,
|
|
68
|
-
},
|
|
69
|
-
dup: {
|
|
70
|
-
duplicate: true,
|
|
71
|
-
},
|
|
72
|
-
enc: {
|
|
73
|
-
encode: true,
|
|
74
|
-
encryption: true,
|
|
75
|
-
},
|
|
76
|
-
gen: {
|
|
77
|
-
generate: true,
|
|
78
|
-
general: true,
|
|
79
|
-
},
|
|
80
|
-
gfx: {
|
|
81
|
-
graphics: true,
|
|
82
|
-
},
|
|
83
|
-
inc: {
|
|
84
|
-
increment: true,
|
|
85
|
-
},
|
|
86
|
-
iter: {
|
|
87
|
-
iterate: true,
|
|
88
|
-
iterator: true,
|
|
89
|
-
},
|
|
90
|
-
nav: {
|
|
91
|
-
navigate: true,
|
|
92
|
-
navigation: true,
|
|
93
|
-
},
|
|
94
|
-
norm: {
|
|
95
|
-
normalize: true,
|
|
96
|
-
},
|
|
97
|
-
notif: {
|
|
98
|
-
notification: true,
|
|
99
|
-
},
|
|
100
|
-
perf: {
|
|
101
|
-
performance: true,
|
|
102
|
-
},
|
|
103
|
-
proc: {
|
|
104
|
-
process: true,
|
|
105
|
-
},
|
|
106
|
-
rand: {
|
|
107
|
-
random: true,
|
|
108
|
-
},
|
|
109
|
-
sys: {
|
|
110
|
-
system: true,
|
|
111
|
-
},
|
|
112
|
-
temp: {
|
|
113
|
-
temporary: true,
|
|
114
|
-
},
|
|
115
|
-
|
|
116
|
-
...extras,
|
|
117
|
-
},
|
|
118
|
-
});
|