@tommy-mitchell/eslint-config-xo 0.1.1 → 0.2.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/helpers.js +106 -0
- package/index.js +12 -2
- package/package.json +20 -9
- package/react.js +0 -1
- package/readme.md +12 -0
package/helpers.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
1
3
|
exports.importOrder = {
|
|
2
4
|
"groups": [
|
|
3
5
|
"builtin",
|
|
@@ -10,3 +12,107 @@ exports.importOrder = {
|
|
|
10
12
|
"warnOnUnassignedImports": true,
|
|
11
13
|
"distinctGroup": true,
|
|
12
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
|
+
});
|
package/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
const { importOrder } = require("./helpers.js");
|
|
2
|
+
const { importOrder, preventAbbreviations } = require("./helpers.js");
|
|
4
3
|
|
|
5
4
|
module.exports = {
|
|
6
5
|
extends: ["plugin:@phaphoso/dprint/disable-conflict-rules"],
|
|
@@ -16,6 +15,15 @@ module.exports = {
|
|
|
16
15
|
ignoreConsecutiveComments: true,
|
|
17
16
|
}],
|
|
18
17
|
"import/order": ["error", importOrder],
|
|
18
|
+
"unicorn/prevent-abbreviations": [
|
|
19
|
+
"error",
|
|
20
|
+
preventAbbreviations({
|
|
21
|
+
pkg: false,
|
|
22
|
+
args: false,
|
|
23
|
+
req: false,
|
|
24
|
+
res: false,
|
|
25
|
+
}),
|
|
26
|
+
],
|
|
19
27
|
},
|
|
20
28
|
overrides: [{
|
|
21
29
|
files: "**/*.{ts,cts,mts,tsx}",
|
|
@@ -26,6 +34,8 @@ module.exports = {
|
|
|
26
34
|
"n/file-extension-in-import": ["error", "always", { ".ts": "always", ".tsx": "always" }],
|
|
27
35
|
// https://github.com/xojs/eslint-config-xo-typescript/blob/v2.0.0/index.js#L707
|
|
28
36
|
"@typescript-eslint/prefer-regexp-exec": "off",
|
|
37
|
+
// Conflicts with dprint
|
|
38
|
+
"@typescript-eslint/space-infix-ops": "off",
|
|
29
39
|
},
|
|
30
40
|
}],
|
|
31
41
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tommy-mitchell/eslint-config-xo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Personal config for XO.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nodejs",
|
|
@@ -28,10 +28,21 @@
|
|
|
28
28
|
"format": "dprint fmt && xo --fix"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"dprint": "
|
|
32
|
-
"react": "
|
|
33
|
-
"tailwindcss": "
|
|
34
|
-
"xo": "
|
|
31
|
+
"dprint": "0.x",
|
|
32
|
+
"react": "18.x",
|
|
33
|
+
"tailwindcss": "3.x",
|
|
34
|
+
"xo": "0.x"
|
|
35
|
+
},
|
|
36
|
+
"peerDependenciesMeta": {
|
|
37
|
+
"dprint": {
|
|
38
|
+
"optional": true
|
|
39
|
+
},
|
|
40
|
+
"react": {
|
|
41
|
+
"optional": true
|
|
42
|
+
},
|
|
43
|
+
"tailwindcss": {
|
|
44
|
+
"optional": true
|
|
45
|
+
}
|
|
35
46
|
},
|
|
36
47
|
"dependencies": {
|
|
37
48
|
"@phaphoso/eslint-plugin-dprint": "^0.5.2",
|
|
@@ -39,11 +50,11 @@
|
|
|
39
50
|
"eslint-plugin-jsx-a11y": "^6.8.0",
|
|
40
51
|
"eslint-plugin-react": "^7.33.2",
|
|
41
52
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
42
|
-
"eslint-plugin-tailwindcss": "^3.14.
|
|
53
|
+
"eslint-plugin-tailwindcss": "^3.14.3"
|
|
43
54
|
},
|
|
44
55
|
"devDependencies": {
|
|
45
|
-
"@tommy-mitchell/dprint-config": "^0.1.
|
|
46
|
-
"dprint": "
|
|
47
|
-
"xo": "
|
|
56
|
+
"@tommy-mitchell/dprint-config": "^0.1.1",
|
|
57
|
+
"dprint": "0.x",
|
|
58
|
+
"xo": "0.x"
|
|
48
59
|
}
|
|
49
60
|
}
|
package/react.js
CHANGED
package/readme.md
CHANGED
|
@@ -11,6 +11,8 @@ npm install --save-dev @tommy-mitchell/eslint-config-xo xo @tommy-mitchell/dprin
|
|
|
11
11
|
<details>
|
|
12
12
|
<summary>Other Package Managers</summary>
|
|
13
13
|
|
|
14
|
+
<br />
|
|
15
|
+
|
|
14
16
|
```sh
|
|
15
17
|
yarn add --dev @tommy-mitchell/eslint-config-xo xo @tommy-mitchell/dprint-config dprint
|
|
16
18
|
```
|
|
@@ -42,6 +44,16 @@ Add to the `extends` section of your `XO` config:
|
|
|
42
44
|
"extends": ["@tommy-mitchell/xo", "@tommy-mitchell/xo/tailwind"],
|
|
43
45
|
```
|
|
44
46
|
|
|
47
|
+
### VS Code
|
|
48
|
+
|
|
49
|
+
Add the following to your `settings.json`:
|
|
50
|
+
|
|
51
|
+
```jsonc
|
|
52
|
+
"xo.enable": true,
|
|
53
|
+
"xo.format.enable": true,
|
|
54
|
+
"xo.overrideSeverity": "warn",
|
|
55
|
+
```
|
|
56
|
+
|
|
45
57
|
## Related
|
|
46
58
|
|
|
47
59
|
- [XO (VS Code Extension)](https://marketplace.visualstudio.com/items?itemName=samverschueren.linter-xo) - Linter for XO.
|