Skip to content

Commit

Permalink
ci: Add support for ESLint 9
Browse files Browse the repository at this point in the history
- Move import sorting to prettier (Import sorting alg. has changed)
- Remove unused dependencies
- Replace `.eslintrs.js` with `eslint.config.mjs`
  • Loading branch information
MoritzWeber0 committed Aug 29, 2024
1 parent 964ae6a commit e51c75c
Show file tree
Hide file tree
Showing 7 changed files with 5,122 additions and 5,626 deletions.
2 changes: 0 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,9 @@ repos:
- '@angular-eslint/[email protected]'
- '@angular-eslint/[email protected]'
- 'eslint-config-prettier@^9.1.0'
- 'eslint-plugin-import@^2.29.1'
- '@typescript-eslint/eslint-plugin@^7.17.0'
- '@typescript-eslint/parser@^7.17.0'
- 'eslint-plugin-unused-imports@^3.2.0'
- 'eslint-plugin-deprecation@^3.0.0'
- 'eslint-plugin-tailwindcss@^3.17.4'
- 'eslint-plugin-storybook@^0.8.0'
args: ['--fix']
Expand Down
8 changes: 0 additions & 8 deletions frontend/.eslintignore

This file was deleted.

12 changes: 2 additions & 10 deletions frontend/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module.exports = {
"plugin:@angular-eslint/recommended",
"plugin:@angular-eslint/template/process-inline-templates",
],
plugins: ["import", "unused-imports", "deprecation"],
plugins: ["import", "unused-imports"],
rules: {
"@angular-eslint/directive-selector": [
"error",
Expand All @@ -39,14 +39,6 @@ module.exports = {
style: "camelCase",
},
],
"import/order": [
"error",
{
alphabetize: {
order: "asc",
},
},
],
"@angular-eslint/sort-ngmodule-metadata-arrays": ["error"],
"@typescript-eslint/no-unused-vars": [
"error",
Expand All @@ -58,7 +50,7 @@ module.exports = {
],
"unused-imports/no-unused-imports": "error",
"no-console": ["error", { allow: ["error"] }],
"deprecation/deprecation": "error",
"@typescript-eslint/no-deprecated": "error",
"@angular-eslint/use-lifecycle-interface": "error",
},
},
Expand Down
6 changes: 5 additions & 1 deletion frontend/.prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,9 @@
*/

module.exports = {
plugins: [require.resolve("prettier-plugin-tailwindcss")],
plugins: [
require.resolve("prettier-plugin-tailwindcss"),
require.resolve("@trivago/prettier-plugin-sort-imports"),
],
importOrderParserPlugins: ["typescript", "tsx", "decorators"],
};
51 changes: 51 additions & 0 deletions frontend/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import unusedImports from "eslint-plugin-unused-imports";
import js from "@eslint/js";
import ts from "typescript-eslint";
import tailwind from "eslint-plugin-tailwindcss";

export default [
{ ignores: ["dist", "tmp", "out-tsc", "**/*.spec.ts"] },
js.configs.recommended,
...ts.configs.recommended,
{
rules: {
"sort-imports": ["error"],
},
},
...tailwind.configs["flat/recommended"],
{
rules: {
"no-console": ["error", { allow: ["error"] }],
},
},
{
settings: {
tailwindcss: {
config: "frontend/tailwind.config.js",
cssFiles: [
"frontend/**/*.css",
"!**/node_modules",
"!**/.*",
"!**/dist",
"!**/build",
],
},
},
},
{
plugins: {
"unused-imports": unusedImports,
},
rules: {
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
},
],
"unused-imports/no-unused-imports": "error",
},
},
];
Loading

0 comments on commit e51c75c

Please sign in to comment.