Skip to content

Commit f7ef399

Browse files
committed
cleanup: prettier and eslint rules
1 parent fae5f65 commit f7ef399

18 files changed

+808
-652
lines changed

.eslintrc.js

+88-60
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,97 @@
11
const aliases = require("./build/aliases.js");
22
const aliasList = Object.entries(aliases).reduce(
3-
(arr, [key, val]) => [...arr, [key, val]],
4-
[]
3+
(arr, [key, val]) => [...arr, [key, val]],
4+
[]
55
);
66

77
module.exports = {
8-
env: {
9-
browser: true,
10-
es2021: true,
11-
node: true,
12-
"jest/globals": true,
13-
},
14-
extends: [
15-
"eslint:recommended",
16-
"plugin:react/recommended",
17-
"plugin:react/jsx-runtime",
18-
"plugin:import/recommended",
19-
"plugin:@typescript-eslint/recommended",
20-
],
21-
parser: "@typescript-eslint/parser",
22-
parserOptions: {
23-
ecmaFeatures: {
24-
jsx: true,
8+
env: {
9+
"browser": true,
10+
"es2021": true,
11+
"node": true,
12+
"jest/globals": true,
2513
},
26-
ecmaVersion: 12,
27-
sourceType: "module",
28-
},
29-
plugins: ["react", "jest", "jest-extended"],
30-
rules: {
31-
"linebreak-style": ["error", "windows"],
32-
quotes: ["error", "double"],
33-
"no-extra-semi": ["error"],
34-
"no-console": ["warn", { allow: ["error"] }],
35-
"react/display-name": 0,
36-
"react/prop-types": 0,
37-
"no-empty": ["error", { allowEmptyCatch: true }],
38-
"import/no-duplicates": 0,
39-
"import/no-unresolved": 0,
40-
"import/namespace": 0,
41-
"import/named": 0,
42-
"no-unused-vars": "off",
43-
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
44-
"no-empty-function": "off",
45-
"@typescript-eslint/no-empty-function": "off",
46-
"@typescript-eslint/ban-ts-comment": "off",
47-
"@typescript-eslint/no-explicit-any": "off",
48-
"@typescript-eslint/no-empty-interface": "off",
49-
"@typescript-eslint/no-var-requires": "off",
50-
"@typescript-eslint/no-non-null-assertion": "off",
51-
},
52-
globals: {
53-
__static: true,
54-
},
55-
settings: {
56-
react: {
57-
pragma: "React",
58-
fragment: "Fragment",
59-
version: "18.0.0",
14+
extends: [
15+
"eslint:recommended",
16+
"plugin:react/recommended",
17+
"plugin:react/jsx-runtime",
18+
"plugin:import/recommended",
19+
"plugin:@typescript-eslint/recommended",
20+
"plugin:@typescript-eslint/recommended-requiring-type-checking",
21+
"plugin:@typescript-eslint/strict",
22+
"prettier",
23+
],
24+
parser: "@typescript-eslint/parser",
25+
parserOptions: {
26+
ecmaFeatures: {
27+
jsx: true,
28+
},
29+
ecmaVersion: 12,
30+
sourceType: "module",
31+
tsconfigRootDir: __dirname,
32+
project: ["./tsconfig.json"],
33+
debugLevel: true,
6034
},
61-
"import/resolver": {
62-
alias: {
63-
map: [...aliasList, ["common", "./src/common"]],
64-
extensions: [".js", ".jsx", ".ts", ".tsx"],
65-
},
35+
plugins: ["react", "jest", "jest-extended", "jsx-a11y"],
36+
rules: {
37+
"quotes": ["error", "double"],
38+
"no-extra-semi": ["error"],
39+
"no-console": ["warn", { allow: ["error"] }],
40+
"liebreak-style": 0,
41+
"no-empty": ["error", { allowEmptyCatch: true }],
42+
"no-unused-vars": "off",
43+
"no-empty-function": "off",
44+
"object-curly-spacing": ["error", "always"],
45+
"space-in-parens": ["error", "always", { exceptions: ["empty"] }],
46+
"computed-property-spacing": ["error", "never"],
47+
"object-curly-newline": [
48+
"error",
49+
{
50+
multiline: true,
51+
consistent: true,
52+
},
53+
],
54+
"padded-blocks": [ "error", "never", { allowSingleLineBlocks: true }],
55+
56+
"react/display-name": 0,
57+
"react/prop-types": 0,
58+
59+
"import/no-duplicates": 0,
60+
"import/no-unresolved": 0,
61+
"import/namespace": 0,
62+
"import/named": 0,
63+
"import/default": 0,
64+
"import/no-named-as-default-member": 0,
65+
66+
"@typescript-eslint/no-unused-vars": [
67+
"error",
68+
{ argsIgnorePattern: "^_" },
69+
],
70+
"@typescript-eslint/no-empty-function": "off",
71+
"@typescript-eslint/ban-ts-comment": "off",
72+
"@typescript-eslint/no-explicit-any": "off",
73+
"@typescript-eslint/no-empty-interface": "off",
74+
"@typescript-eslint/no-var-requires": "off",
75+
"@typescript-eslint/no-non-null-assertion": "off",
76+
77+
"@typescript-eslint/no-misused-promises": "off",
78+
"@typescript-eslint/no-floating-promises": "off",
79+
},
80+
globals: {
81+
__static: true,
82+
},
83+
settings: {
84+
"react": {
85+
pragma: "React",
86+
fragment: "Fragment",
87+
version: "18.0.0",
88+
},
89+
"import/resolver": {
90+
alias: {
91+
map: [...aliasList, ["common", "./src/common"]],
92+
extensions: [".js", ".jsx", ".ts", ".tsx"],
93+
},
94+
},
95+
"import/ignore": [".worker.js"],
6696
},
67-
"import/ignore": [".worker.js"],
68-
},
6997
};

.prettierrc

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"tabWidth": 4,
3+
"useTabs": false,
4+
"trailingComma": "es5",
5+
"quoteProps": "consistent",
6+
"arrowParens": "always",
7+
"bracketSameLine": true,
8+
"semi": true,
9+
"singleQuote": false,
10+
"bracketSpacing": true,
11+
"printWidth": 88
12+
}

babel.config.js

-7
This file was deleted.

jest.config.js

-39
This file was deleted.

package.json

+5-3
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@
77
"scripts": {
88
"dev": "vite",
99
"sanity": "yarn typecheck && yarn test:once",
10+
"deep-cleanse": "yarn eslint .",
1011
"typecheck": "tsc --noEmit",
1112
"test": "jest --watchAll",
1213
"test:once": "jest --runInBand",
1314
"test:debug": "node --inspect node_modules/jest/bin/jest --runInBand",
1415
"clear-cache": "rimraf .cache dist",
1516
"build": "vite build",
1617
"dist": "vite build && electron-builder",
17-
"lint": "yarn eslint .",
18+
"lint": "yarn eslint . && yarn prettier --check .",
1819
"clean-dev-win": "taskkill /f /im node.exe",
1920
"postinstall": "git apply -v --stat --directory=node_modules/scm-extractor build/patches/scm-extractor.patch",
2021
"build-api-types": "ts-node -T .\\build\\apis\\build-api-types.ts"
@@ -147,7 +148,7 @@
147148
"electron": "21.1.0",
148149
"electron-builder": "^23.3.3",
149150
"eslint": "^8.24.0",
150-
"eslint-config-airbnb": "^19.0.4",
151+
"eslint-config-prettier": "^8.5.0",
151152
"eslint-import-resolver-alias": "^1.1.2",
152153
"eslint-plugin-import": "^2.25.2",
153154
"eslint-plugin-jest": "^27.1.1",
@@ -158,7 +159,8 @@
158159
"jest": "^29.0.3",
159160
"jest-environment-jsdom": "^29.0.3",
160161
"jest-extended": "^3.1.0",
161-
"prettier": "^2.4.1",
162+
"prettier": "^2.7.1",
163+
"prettier-plugin-glsl": "^0.0.5",
162164
"reflect-metadata": "^0.1.13",
163165
"rimraf": "^3.0.2",
164166
"source-map-support": "^0.5.19",
+14-9
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,37 @@
11
declare const __static: string;
22

33
declare module "*?worker" {
4-
54
class Worker {
6-
postMessage(message: object, transferList?: unknown[]): void;
7-
onmessage?: (message: { data: unknown; }) => void;
5+
postMessage( message: object, transferList?: unknown[] ): void;
6+
onmessage?: ( message: { data: unknown } ) => void;
87
terminate(): void;
98
}
109
export default Worker;
1110
}
1211

1312
declare module "*?raw" {
1413
const contents: string;
15-
export = contents
14+
export = contents;
1615
}
1716
declare module "*.svg" {
1817
const contents: string;
19-
export = contents
18+
export = contents;
2019
}
2120

2221
declare module "*.png" {
2322
const contents: string;
24-
export = contents
23+
export = contents;
2524
}
2625

27-
2826
interface NodeModule {
2927
hot?: {
30-
accept: (dependencies?: string | string[], callback?: () => void, errorHandler?: (error: Error, info: { moduleId: string, dependencyId: string }) => void) => void;
28+
accept: (
29+
dependencies?: string | string[],
30+
callback?: () => void,
31+
errorHandler?: (
32+
error: Error,
33+
info: { moduleId: string; dependencyId: string }
34+
) => void
35+
) => void;
3136
};
32-
}
37+
}

0 commit comments

Comments
 (0)