Skip to content

Commit 86882c0

Browse files
committed
xo: Move configuration to xo.config.cjs.
Signed-off-by: Anders Kaseorg <[email protected]>
1 parent cf5a691 commit 86882c0

File tree

3 files changed

+109
-139
lines changed

3 files changed

+109
-139
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ charset = utf-8
66
trim_trailing_whitespace = true
77
insert_final_newline = true
88

9-
[{*.css,*.html,*.js,*.json,*.ts}]
9+
[{*.cjs,*.css,*.html,*.js,*.json,*.ts}]
1010
indent_style = space
1111
indent_size = 2

package.json

Lines changed: 1 addition & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"lint-css": "stylelint \"app/**/*.css\"",
2929
"lint-html": "htmlhint \"app/**/*.html\"",
3030
"lint-js": "xo",
31-
"prettier-non-js": "prettier --check --log-level=warn . \"!**/*.{js,ts}\"",
31+
"prettier-non-js": "prettier --check --log-level=warn . \"!**/*.{cjs,js,ts}\"",
3232
"test": "tsc && npm run lint-html && npm run lint-css && npm run lint-js && npm run prettier-non-js",
3333
"test-e2e": "vite build && tape \"tests/**/*.js\"",
3434
"pack": "vite build && electron-builder --dir",
@@ -196,142 +196,5 @@
196196
"bracketSpacing": false,
197197
"singleQuote": false,
198198
"trailingComma": "all"
199-
},
200-
"xo": {
201-
"prettier": true,
202-
"rules": {
203-
"@typescript-eslint/no-dynamic-delete": "off",
204-
"arrow-body-style": "error",
205-
"import/no-restricted-paths": [
206-
"error",
207-
{
208-
"zones": [
209-
{
210-
"target": "./app/common",
211-
"from": "./app",
212-
"except": [
213-
"./common"
214-
]
215-
},
216-
{
217-
"target": "./app/main",
218-
"from": "./app",
219-
"except": [
220-
"./common",
221-
"./main"
222-
]
223-
},
224-
{
225-
"target": "./app/renderer",
226-
"from": "./app",
227-
"except": [
228-
"./common",
229-
"./renderer",
230-
"./resources"
231-
]
232-
}
233-
]
234-
}
235-
],
236-
"import/order": [
237-
"error",
238-
{
239-
"alphabetize": {
240-
"order": "asc"
241-
},
242-
"newlines-between": "always"
243-
}
244-
],
245-
"import/unambiguous": "error",
246-
"no-restricted-imports": [
247-
"error",
248-
{
249-
"paths": [
250-
{
251-
"name": "@sentry/electron",
252-
"message": "Use @sentry/electron/main, @sentry/electron/renderer, or @sentry/core."
253-
},
254-
{
255-
"name": "electron",
256-
"message": "Use electron/main, electron/renderer, or electron/common."
257-
},
258-
{
259-
"name": "electron/main",
260-
"importNames": [
261-
"ipcMain"
262-
],
263-
"message": "Use typed-ipc-main."
264-
},
265-
{
266-
"name": "electron/renderer",
267-
"importNames": [
268-
"ipcRenderer"
269-
],
270-
"message": "Use typed-ipc-renderer."
271-
},
272-
{
273-
"name": "electron-log",
274-
"message": "Use electron-log/main or electron-log/renderer."
275-
}
276-
]
277-
}
278-
],
279-
"no-warning-comments": "off",
280-
"sort-imports": [
281-
"error",
282-
{
283-
"ignoreDeclarationSort": true
284-
}
285-
],
286-
"strict": "error",
287-
"unicorn/prefer-module": "off",
288-
"unicorn/prefer-top-level-await": "off"
289-
},
290-
"envs": [
291-
"node",
292-
"browser"
293-
],
294-
"overrides": [
295-
{
296-
"files": [
297-
"**/*.ts"
298-
],
299-
"rules": {
300-
"@typescript-eslint/ban-types": "off",
301-
"@typescript-eslint/consistent-type-imports": [
302-
"error",
303-
{
304-
"disallowTypeAnnotations": false
305-
}
306-
],
307-
"@typescript-eslint/no-unused-vars": [
308-
"error",
309-
{
310-
"argsIgnorePattern": "^_",
311-
"caughtErrors": "all"
312-
}
313-
],
314-
"unicorn/no-await-expression-member": "off"
315-
}
316-
},
317-
{
318-
"files": [
319-
"i18next-scanner.config.js",
320-
"scripts/win-sign.js",
321-
"tests/**/*.js"
322-
],
323-
"parserOptions": {
324-
"sourceType": "script"
325-
}
326-
},
327-
{
328-
"files": [
329-
"**/*.d.ts"
330-
],
331-
"rules": {
332-
"import/unambiguous": "off"
333-
}
334-
}
335-
]
336199
}
337200
}

xo.config.cjs

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
"use strict";
2+
3+
module.exports = {
4+
prettier: true,
5+
rules: {
6+
"@typescript-eslint/no-dynamic-delete": "off",
7+
"arrow-body-style": "error",
8+
"import/no-restricted-paths": [
9+
"error",
10+
{
11+
zones: [
12+
{
13+
target: "./app/common",
14+
from: "./app",
15+
except: ["./common"],
16+
},
17+
{
18+
target: "./app/main",
19+
from: "./app",
20+
except: ["./common", "./main"],
21+
},
22+
{
23+
target: "./app/renderer",
24+
from: "./app",
25+
except: ["./common", "./renderer", "./resources"],
26+
},
27+
],
28+
},
29+
],
30+
"import/order": [
31+
"error",
32+
{alphabetize: {order: "asc"}, "newlines-between": "always"},
33+
],
34+
"import/unambiguous": "error",
35+
"no-restricted-imports": [
36+
"error",
37+
{
38+
paths: [
39+
{
40+
name: "@sentry/electron",
41+
message:
42+
"Use @sentry/electron/main, @sentry/electron/renderer, or @sentry/core.",
43+
},
44+
{
45+
name: "electron",
46+
message:
47+
"Use electron/main, electron/renderer, or electron/common.",
48+
},
49+
{
50+
name: "electron/main",
51+
importNames: ["ipcMain"],
52+
message: "Use typed-ipc-main.",
53+
},
54+
{
55+
name: "electron/renderer",
56+
importNames: ["ipcRenderer"],
57+
message: "Use typed-ipc-renderer.",
58+
},
59+
{
60+
name: "electron-log",
61+
message: "Use electron-log/main or electron-log/renderer.",
62+
},
63+
],
64+
},
65+
],
66+
"no-warning-comments": "off",
67+
"sort-imports": ["error", {ignoreDeclarationSort: true}],
68+
strict: "error",
69+
"unicorn/prefer-module": "off",
70+
"unicorn/prefer-top-level-await": "off",
71+
},
72+
envs: ["node", "browser"],
73+
overrides: [
74+
{
75+
files: ["**/*.ts"],
76+
rules: {
77+
"@typescript-eslint/ban-types": "off",
78+
"@typescript-eslint/consistent-type-imports": [
79+
"error",
80+
{disallowTypeAnnotations: false},
81+
],
82+
"@typescript-eslint/no-unused-vars": [
83+
"error",
84+
{argsIgnorePattern: "^_", caughtErrors: "all"},
85+
],
86+
"unicorn/no-await-expression-member": "off",
87+
},
88+
},
89+
{
90+
files: [
91+
"**.cjs",
92+
"i18next-scanner.config.js",
93+
"scripts/win-sign.js",
94+
"tests/**/*.js",
95+
],
96+
parserOptions: {
97+
sourceType: "script",
98+
},
99+
},
100+
{
101+
files: ["**/*.d.ts"],
102+
rules: {
103+
"import/unambiguous": "off",
104+
},
105+
},
106+
],
107+
};

0 commit comments

Comments
 (0)