forked from tobspr-games/shapez.io
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from tobspr-games/dengr1065/eslint-tsc-revamp
Redo ESLint and TypeScript configuration
- Loading branch information
Showing
21 changed files
with
404 additions
and
431 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import eslint from "@eslint/js"; | ||
import globals from "globals"; | ||
import path from "path"; | ||
import tseslint from "typescript-eslint"; | ||
import { fileURLToPath } from "url"; | ||
|
||
const baseConfig = tseslint.config( | ||
eslint.configs.recommended, | ||
...tseslint.configs.recommendedTypeChecked, | ||
// Enable type-aware linting | ||
{ | ||
languageOptions: { | ||
parserOptions: { | ||
project: true, | ||
// FIXME: Node.js 21.2.0 introduced import.meta.dirname | ||
tsconfigRootDir: path.dirname(fileURLToPath(import.meta.url)), | ||
}, | ||
}, | ||
}, | ||
// 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, so don't annoy with errors but keep | ||
// a reminder! | ||
"@typescript-eslint/no-unused-vars": "warn", | ||
// 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)"], | ||
ignores: ["gulp/preloader/*.js"], | ||
})), | ||
...runtimeConfig.map(config => ({ | ||
...config, | ||
files: ["src/**/*.(ts|js)x?"], | ||
})), | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
{ | ||
"extends": ["../../tsconfig"], | ||
"compilerOptions": { | ||
"lib": ["ES2018", "WebWorker"] | ||
}, | ||
"exclude": [], | ||
"extends": "../tsconfig", | ||
"include": ["*.worker.js"] | ||
"lib": ["WebWorker"] | ||
} | ||
} |
Oops, something went wrong.