Skip to content

Commit 122e3b1

Browse files
committed
chore: Improved linting
1 parent 289a774 commit 122e3b1

File tree

135 files changed

+571
-570
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

135 files changed

+571
-570
lines changed

demo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"eslint-plugin-react-refresh": "^0.4.7",
5757
"gh-pages": "^6.1.1",
5858
"stylelint": "^16.6.1",
59-
"typescript": "^5.4.5",
59+
"typescript": "^5.5.4",
6060
"typescript-eslint": "^7.13.1",
6161
"vite-node": "^2.1.2",
6262
"vite-plugin-checker": "^0.7.1"

demo/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"src",
1212
"vite.config.ts",
1313
"scripts",
14-
"../packages/core/src/**/*",
14+
"../packages/core/src/**/*", "../types/eslint.d.ts",
1515
],
1616
"exclude": ["node_modules"]
1717
}

demo/vite.config.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function generateAliases() {
2828
{ name: "prozilla-os", path: resolve(__dirname, "../packages/prozilla-os/" + entryFile) },
2929
{ name: "@prozilla-os/core", path: resolve(__dirname, "../packages/core/" + entryFile) },
3030
{ name: "@prozilla-os/shared", path: resolve(__dirname, "../packages/shared/" + entryFile) },
31-
{ name: "@prozilla-os/skins", path: resolve(__dirname, "../packages/skins/" + entryFile) }
31+
{ name: "@prozilla-os/skins", path: resolve(__dirname, "../packages/skins/" + entryFile) },
3232
];
3333

3434
const localApps = [
@@ -66,7 +66,11 @@ export default defineConfig(({ command }) => {
6666
react(),
6767
checker({
6868
typescript: true,
69-
})
69+
eslint: {
70+
lintCommand: "eslint -c ../eslint.config.js ../**/src/**/*",
71+
useFlatConfig: true,
72+
},
73+
}),
7074
],
7175
build: {
7276
outDir: BUILD_DIR,
@@ -77,14 +81,14 @@ export default defineConfig(({ command }) => {
7781
appsConfig,
7882
siteName: NAME,
7983
siteTagLine: TAG_LINE,
80-
domain: DOMAIN
81-
})
84+
domain: DOMAIN,
85+
}),
8286
],
8387
output: {
8488
assetFileNames: "assets/[name][extname]",
8589
chunkFileNames: "chunks/[name]-[hash].js",
8690
entryFileNames: "[name].js",
87-
}
91+
},
8892
},
8993
},
9094
resolve: {
@@ -95,6 +99,6 @@ export default defineConfig(({ command }) => {
9599
},
96100
optimizeDeps: {
97101
exclude: devMode ? Object.keys(aliases) : [],
98-
}
102+
},
99103
} as UserConfig;
100104
});

eslint.config.js

Lines changed: 93 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,12 @@ export default tseslint.config(
2121
"**/dist/**/*"
2222
],
2323
plugins: {
24-
// @ts-ignore
25-
react,
24+
"react": /** @type {import("eslint").ESLint.Plugin} */ (react),
2625
"react-refresh": reactRefresh,
2726
},
2827
rules: {
2928
"quotes": ["error", "double"],
3029
"no-unused-vars": "off",
31-
"@typescript-eslint/ban-types": "off",
3230
"indent": [
3331
"error",
3432
"tab",
@@ -46,38 +44,112 @@ export default tseslint.config(
4644
"default-case": "off",
4745
"arrow-parens": "error",
4846
"space-infix-ops": "warn",
49-
"react/no-multi-comp": [
50-
"error",
47+
"comma-spacing": "warn",
48+
"comma-dangle": [
49+
"warn",
5150
{
52-
"ignoreStateless": true
51+
"arrays": "always-multiline",
52+
"objects": "always-multiline",
53+
"imports": "always-multiline",
54+
"exports": "always-multiline",
55+
"functions": "never"
5356
}
5457
],
55-
"comma-spacing": "warn",
56-
"@typescript-eslint/no-unused-vars": [
57-
"warn",
58+
"keyword-spacing": "error",
59+
"react/no-multi-comp": [
60+
"error",
5861
{
59-
"argsIgnorePattern": "^_"
62+
"ignoreStateless": true
6063
}
6164
],
65+
"react/no-invalid-html-attribute": "error",
66+
"react/boolean-prop-naming": "warn",
67+
"react/jsx-handler-names": "warn",
6268
"react-refresh/only-export-components": [
6369
"warn",
6470
{ "allowConstantExport": true }
6571
],
66-
"@typescript-eslint/await-thenable": "off",
67-
"react/boolean-prop-naming": "warn",
68-
"react/jsx-handler-names": "warn",
69-
"comma-dangle": [
72+
"@typescript-eslint/ban-types": "off",
73+
"@typescript-eslint/no-unused-vars": [
7074
"warn",
7175
{
72-
"arrays": "always-multiline",
73-
"objects": "always-multiline",
74-
"imports": "always-multiline",
75-
"exports": "always-multiline",
76-
"functions": "never"
76+
"args": "all",
77+
"argsIgnorePattern": "^_",
78+
"caughtErrors": "all",
79+
"caughtErrorsIgnorePattern": "^_",
80+
"destructuredArrayIgnorePattern": "^_",
81+
"varsIgnorePattern": "^_",
82+
"ignoreRestSiblings": true
7783
}
7884
],
79-
"keyword-spacing": "error",
80-
"react/no-invalid-html-attribute": "error",
85+
"@typescript-eslint/naming-convention": [
86+
"error",
87+
{
88+
selector: "default",
89+
format: ["camelCase"],
90+
leadingUnderscore: "allow",
91+
trailingUnderscore: "allow",
92+
},
93+
{
94+
selector: "import",
95+
format: ["camelCase", "PascalCase"],
96+
},
97+
{
98+
// React components and Variables
99+
selector: "variable",
100+
format: ["camelCase", "UPPER_CASE", "PascalCase"],
101+
leadingUnderscore: "allow",
102+
},
103+
{
104+
// Types and enum members
105+
selector: ["typeLike", "enumMember"],
106+
format: ["PascalCase"],
107+
},
108+
{
109+
// React components, functions and properties
110+
selector: [
111+
"function",
112+
"parameter",
113+
"classProperty",
114+
"objectLiteralProperty",
115+
"typeProperty",
116+
"classMethod",
117+
"objectLiteralMethod",
118+
"typeMethod",
119+
"accessor",
120+
],
121+
format: ["camelCase", "PascalCase"],
122+
leadingUnderscore: "allow",
123+
},
124+
{
125+
// Static class fields
126+
selector: "classProperty",
127+
modifiers: ["static"],
128+
format: ["UPPER_CASE"],
129+
},
130+
{
131+
// Ignore destructured variables and parameters
132+
selector: ["variable", "parameter"],
133+
modifiers: ["destructured"],
134+
format: null,
135+
},
136+
{
137+
// Ignore properties that require quotes
138+
selector: [
139+
"classProperty",
140+
"objectLiteralProperty",
141+
"typeProperty",
142+
"classMethod",
143+
"objectLiteralMethod",
144+
"typeMethod",
145+
"accessor",
146+
"enumMember",
147+
],
148+
modifiers: ["requiresQuotes"],
149+
format: null,
150+
},
151+
],
152+
"@typescript-eslint/await-thenable": "off"
81153
},
82154
}
83155
);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"eslint-plugin-react-refresh": "^0.4.7",
5555
"rimraf": "^5.0.10",
5656
"stylelint": "^16.6.1",
57-
"typescript": "^5.4.5",
57+
"typescript": "^5.5.4",
5858
"typescript-eslint": "^8.8.1",
5959
"vite-node": "^2.1.2",
6060
"vite-plugin-checker": "^0.7.1"

packages/apps/app-center/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"@types/node": "^20.14.5",
3131
"@types/react": "^18.3.3",
3232
"@vitejs/plugin-react-swc": "^3.7.0",
33-
"typescript": "^5.4.5",
33+
"typescript": "^5.5.4",
3434
"vite": "^5.4.8",
3535
"vite-plugin-dts": "^3.9.1",
3636
"vite-plugin-lib-inject-css": "^2.1.1"

packages/apps/app-center/src/components/list/List.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export function List({ apps, searchQuery, category }: ListProps) {
1212
return <div className={styles.List}>
1313
{apps.filter(({ name, id, category: appCategory }) => {
1414
return (name.toLowerCase().includes(searchQuery) || id.toLowerCase().replaceAll("-", " ").includes(searchQuery))
15-
&& (category == "All" || appCategory == category)
15+
&& (category == "All" || appCategory == category);
1616
}).map(({ name, id, iconUrl }) =>
1717
<div key={id} className={styles.App}>
1818
<div className={styles.AppIcon}>{iconUrl && <Image src={iconUrl}/>}</div>

packages/apps/browser/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"@types/node": "^20.14.5",
3131
"@types/react": "^18.3.3",
3232
"@vitejs/plugin-react-swc": "^3.7.0",
33-
"typescript": "^5.4.5",
33+
"typescript": "^5.5.4",
3434
"vite": "^5.4.8",
3535
"vite-plugin-dts": "^3.9.1",
3636
"vite-plugin-lib-inject-css": "^2.1.1"

packages/apps/browser/src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Browser, BrowserProps } from "./components/Browser";
33

44
const browser = new App<BrowserProps>("Browser", "browser", Browser, { size: new Vector2(700, 500) })
55
.setIconUrl("https://os.prozilla.dev/assets/apps/icons/browser.svg")
6-
.setRole(AppsConfig.APP_ROLES.Browser)
6+
.setRole(AppsConfig.APP_ROLES.browser)
77
.setCategory("Utilities & tools");
88

99
export { browser };

packages/apps/calculator/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"@types/node": "^20.14.5",
3131
"@types/react": "^18.3.3",
3232
"@vitejs/plugin-react-swc": "^3.7.0",
33-
"typescript": "^5.4.5",
33+
"typescript": "^5.5.4",
3434
"vite": "^5.4.8",
3535
"vite-plugin-dts": "^3.9.1",
3636
"vite-plugin-lib-inject-css": "^2.1.1"

0 commit comments

Comments
 (0)