1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-12-10 00:31:51 +00:00
tobspr_shapez.io/eslint.config.js
Даниїл Григор'єв 75e306ec59
Migrate from Yarn Classic to npm (#65)
* Switch to npm in electron/

May change resolved package versions.

* Remove redundant electron-notarize dependency

The number of dependencies stays the same. Only direct mention in
package.json is removed.

* Assume Node.js 22.x and clean up dependencies

Targeting Node.js 22.x allows using the new fs.glob* functions, which
can replace the glob module. It is still downloaded as there are other
packages using it, but is no longer included in devDependencies.

Also remove @types/filesystem, as this API is not used anywhere in the
code, it is non-standard and some of it was removed from Chromium. Was
likely used with Cordova for YORG.io 3 mobile support.

* Update linting stack

Install the latest versions of the following packages:

- @eslint/js (^9.24.0)
- eslint (^9.24.0)
- typescript-eslint (^8.29.1)

and remove packages that are no longer used:

- @types/eslint__js
- yarn

Config files were not modified.

* Switch root package to npm

npm is able to resolve packages using yarn.lock as a resolution hint.
Note that files other than those included in this commit are
intentionally kept outdated, as they may need a bigger change.
2025-04-10 23:22:03 +03:00

62 lines
1.5 KiB
JavaScript

import eslint from "@eslint/js";
import globals from "globals";
import tseslint from "typescript-eslint";
const baseConfig = tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommendedTypeChecked,
// Enable type-aware linting
{
languageOptions: {
parserOptions: {
project: true,
tsconfigRootDir: import.meta.dirname,
},
},
},
// Disable type-aware linting for JS files as it causes issues
{
files: ["*.js"],
...tseslint.configs.disableTypeChecked,
}
);
const nodeConfig = tseslint.config(...baseConfig, {
languageOptions: {
sourceType: "module",
globals: {
...globals.node,
},
},
});
const runtimeConfig = tseslint.config(...baseConfig, {
languageOptions: {
sourceType: "module",
globals: {
...globals.browser,
},
},
rules: {
// Mostly caused by JSDoc imports, disable for now
"@typescript-eslint/no-unused-vars": "off",
// FIXME: enforce when we're ready to
"prefer-const": "warn",
},
});
// I don't know what the ESLint devs were thinking about. This is just horrible
export default [
{
ignores: ["build/*"],
},
...nodeConfig.map(config => ({
...config,
files: ["*.{ts,js}", "{gulp,electron}/**/*.{ts,js}"],
})),
...runtimeConfig.map(config => ({
...config,
files: ["src/**/*.{ts,js,tsx,jsx}"],
})),
];