@tommy-mitchell/eslint-config-xo 0.1.1 → 0.2.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/helpers.js +104 -0
- package/index.js +12 -1
- package/package.json +1 -1
- package/readme.md +10 -0
package/helpers.js
CHANGED
|
@@ -10,3 +10,107 @@ exports.importOrder = {
|
|
|
10
10
|
"warnOnUnassignedImports": true,
|
|
11
11
|
"distinctGroup": true,
|
|
12
12
|
};
|
|
13
|
+
|
|
14
|
+
// Defaults from https://github.com/xojs/xo/blob/v0.57.0/config/plugins.cjs#L38
|
|
15
|
+
exports.preventAbbreviations = (extras) => ({
|
|
16
|
+
checkFilenames: false,
|
|
17
|
+
checkDefaultAndNamespaceImports: false,
|
|
18
|
+
checkShorthandImports: false,
|
|
19
|
+
extendDefaultReplacements: true,
|
|
20
|
+
replacements: {
|
|
21
|
+
// https://thenextweb.com/dd/2020/07/13/linux-kernel-will-no-longer-use-terms-blacklist-and-slave/
|
|
22
|
+
whitelist: {
|
|
23
|
+
include: true,
|
|
24
|
+
},
|
|
25
|
+
blacklist: {
|
|
26
|
+
exclude: true,
|
|
27
|
+
},
|
|
28
|
+
master: {
|
|
29
|
+
main: true,
|
|
30
|
+
},
|
|
31
|
+
slave: {
|
|
32
|
+
secondary: true,
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
// Reverse.
|
|
36
|
+
application: {
|
|
37
|
+
app: true,
|
|
38
|
+
},
|
|
39
|
+
applications: {
|
|
40
|
+
apps: true,
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
// Disable some that may be too annoying.
|
|
44
|
+
env: false,
|
|
45
|
+
i: false, // Do it at some point, but not ready for it yet. Maybe 2025.
|
|
46
|
+
|
|
47
|
+
// Not part of `eslint-plugin-unicorn`. Upstream them at some point.
|
|
48
|
+
bin: {
|
|
49
|
+
binary: true,
|
|
50
|
+
},
|
|
51
|
+
eof: {
|
|
52
|
+
endOfFile: true,
|
|
53
|
+
},
|
|
54
|
+
impl: {
|
|
55
|
+
implement: true,
|
|
56
|
+
implementation: true,
|
|
57
|
+
},
|
|
58
|
+
anim: {
|
|
59
|
+
animation: true,
|
|
60
|
+
},
|
|
61
|
+
calc: {
|
|
62
|
+
calculate: true,
|
|
63
|
+
},
|
|
64
|
+
dict: {
|
|
65
|
+
dictionary: true,
|
|
66
|
+
},
|
|
67
|
+
dup: {
|
|
68
|
+
duplicate: true,
|
|
69
|
+
},
|
|
70
|
+
enc: {
|
|
71
|
+
encode: true,
|
|
72
|
+
encryption: true,
|
|
73
|
+
},
|
|
74
|
+
gen: {
|
|
75
|
+
generate: true,
|
|
76
|
+
general: true,
|
|
77
|
+
},
|
|
78
|
+
gfx: {
|
|
79
|
+
graphics: true,
|
|
80
|
+
},
|
|
81
|
+
inc: {
|
|
82
|
+
increment: true,
|
|
83
|
+
},
|
|
84
|
+
iter: {
|
|
85
|
+
iterate: true,
|
|
86
|
+
iterator: true,
|
|
87
|
+
},
|
|
88
|
+
nav: {
|
|
89
|
+
navigate: true,
|
|
90
|
+
navigation: true,
|
|
91
|
+
},
|
|
92
|
+
norm: {
|
|
93
|
+
normalize: true,
|
|
94
|
+
},
|
|
95
|
+
notif: {
|
|
96
|
+
notification: true,
|
|
97
|
+
},
|
|
98
|
+
perf: {
|
|
99
|
+
performance: true,
|
|
100
|
+
},
|
|
101
|
+
proc: {
|
|
102
|
+
process: true,
|
|
103
|
+
},
|
|
104
|
+
rand: {
|
|
105
|
+
random: true,
|
|
106
|
+
},
|
|
107
|
+
sys: {
|
|
108
|
+
system: true,
|
|
109
|
+
},
|
|
110
|
+
temp: {
|
|
111
|
+
temporary: true,
|
|
112
|
+
},
|
|
113
|
+
|
|
114
|
+
...extras,
|
|
115
|
+
},
|
|
116
|
+
});
|
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
const { importOrder } = require("./helpers.js");
|
|
3
|
+
const { importOrder, preventAbbreviations } = require("./helpers.js");
|
|
4
4
|
|
|
5
5
|
module.exports = {
|
|
6
6
|
extends: ["plugin:@phaphoso/dprint/disable-conflict-rules"],
|
|
@@ -16,6 +16,15 @@ module.exports = {
|
|
|
16
16
|
ignoreConsecutiveComments: true,
|
|
17
17
|
}],
|
|
18
18
|
"import/order": ["error", importOrder],
|
|
19
|
+
"unicorn/prevent-abbreviations": [
|
|
20
|
+
"error",
|
|
21
|
+
preventAbbreviations({
|
|
22
|
+
pkg: false,
|
|
23
|
+
args: false,
|
|
24
|
+
req: false,
|
|
25
|
+
res: false,
|
|
26
|
+
}),
|
|
27
|
+
],
|
|
19
28
|
},
|
|
20
29
|
overrides: [{
|
|
21
30
|
files: "**/*.{ts,cts,mts,tsx}",
|
|
@@ -26,6 +35,8 @@ module.exports = {
|
|
|
26
35
|
"n/file-extension-in-import": ["error", "always", { ".ts": "always", ".tsx": "always" }],
|
|
27
36
|
// https://github.com/xojs/eslint-config-xo-typescript/blob/v2.0.0/index.js#L707
|
|
28
37
|
"@typescript-eslint/prefer-regexp-exec": "off",
|
|
38
|
+
// Conflicts with dprint
|
|
39
|
+
"@typescript-eslint/space-infix-ops": "off",
|
|
29
40
|
},
|
|
30
41
|
}],
|
|
31
42
|
};
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -42,6 +42,16 @@ Add to the `extends` section of your `XO` config:
|
|
|
42
42
|
"extends": ["@tommy-mitchell/xo", "@tommy-mitchell/xo/tailwind"],
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
+
### VS Code
|
|
46
|
+
|
|
47
|
+
Add the following to your `settings.json`:
|
|
48
|
+
|
|
49
|
+
```jsonc
|
|
50
|
+
"xo.enable": true,
|
|
51
|
+
"xo.format.enable": true,
|
|
52
|
+
"xo.overrideSeverity": "warn",
|
|
53
|
+
```
|
|
54
|
+
|
|
45
55
|
## Related
|
|
46
56
|
|
|
47
57
|
- [XO (VS Code Extension)](https://marketplace.visualstudio.com/items?itemName=samverschueren.linter-xo) - Linter for XO.
|