Skip to content

Commit

Permalink
chore(linting): update ESLint to latest version (#6430)
Browse files Browse the repository at this point in the history
# Motivation

We want to update ESLint to its latest version, as it is no longer
supported. This follows up on #6391, and it is important because
ESLint@8 is outdated.

![Screenshot 2025-02-15 at 11 30
43](https://github.com/user-attachments/assets/c6228b1b-6f13-4980-8348-82341828b486)

To minimize the necessary changes due to the differences in how some
rules apply now compared to before, I've overwritten certain rules. This
will be addressed in a follow-up.

# Changes

- Upgrades ESLint and relevant packages to the latest version.  
- Installs new required packages.  
- Removes packages that are no longer needed.  

# Tests

- Linting should pass as it did previously.

# Todos

- [ ] Add entry to changelog (if necessary).
Not necessary
  • Loading branch information
yhabib authored Feb 17, 2025
1 parent 6b56880 commit 6871f6c
Show file tree
Hide file tree
Showing 26 changed files with 1,119 additions and 959 deletions.
22 changes: 0 additions & 22 deletions frontend/.eslintignore

This file was deleted.

45 changes: 0 additions & 45 deletions frontend/.eslintrc.cjs

This file was deleted.

84 changes: 84 additions & 0 deletions frontend/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import jsLint from "@eslint/js";
import prettierPlugin from "eslint-config-prettier";
import sveltePlugin from "eslint-plugin-svelte";
import globals from "globals";
import svelteParser from "svelte-eslint-parser";
import tsLint from "typescript-eslint";
import svelteConfig from "./svelte.config.js";

export default [
jsLint.configs.recommended,
...tsLint.configs.recommended,
{
name: "globals",
languageOptions: {
globals: {
...globals.browser,
...globals.node,
NodeJS: true,
},
parser: tsLint.parser,
ecmaVersion: 2020,
sourceType: "module",
parserOptions: {
extraFileExtensions: [".svelte"],
},
},
rules: {
"@typescript-eslint/no-unused-vars": [
"warn",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
},
],
"no-underscore-dangle": "off",
// TODO: Fix after migration
"no-constant-binary-expression": "off",
"@typescript-eslint/no-empty-object-type": "off",
"@typescript-eslint/no-unused-expressions": "off",
},
},
...sveltePlugin.configs["flat/recommended"],
{
name: "svelte",
files: ["**/*.svelte"],
languageOptions: {
parser: svelteParser,
parserOptions: {
parser: tsLint.parser,
svelteConfig,
},
},
},
prettierPlugin,
{
name: "ignores",
ignores: [
// ignorePatterns
"src/lib/canisters/**/*",
// .eslintignore
"**/.DS_Store",
"build",
".svelte-kit",
"package",
"playwright*",
"**/.env",
"**/.env.*",
"!**/.env.example",
// Ignore files for PNPM, NPM and YARN
"**/pnpm-lock.yaml",
"**/package-lock.json",
"**/yarn.lock",

"static",
"public",
"scripts",

"src/lib/canisters/nns-dapp/**/*",

"**/coverage",
],
},
];
Loading

0 comments on commit 6871f6c

Please sign in to comment.