-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
⬆️ (repo) [DSDK-273]: Bump eslint to v9 (#98)
- Loading branch information
Showing
40 changed files
with
1,163 additions
and
2,345 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import baseConfig from "@ledgerhq/eslint-config-dsdk"; | ||
import globals from "globals"; | ||
|
||
export default [ | ||
...baseConfig, | ||
{ | ||
ignores: [".next"], | ||
}, | ||
{ | ||
languageOptions: { | ||
parserOptions: { | ||
project: "./tsconfig.eslint.json", | ||
}, | ||
}, | ||
}, | ||
{ | ||
files: [ | ||
"src/app/page.tsx", | ||
"src/app/global-error.tsx", | ||
"src/app/client-layout.tsx", | ||
"src/app/**/page.tsx", | ||
], | ||
rules: { | ||
"no-restricted-syntax": 0, | ||
}, | ||
}, | ||
{ | ||
files: ["next.config.js", "postcss.config.js"], | ||
languageOptions: { | ||
globals: { | ||
...globals.node, | ||
}, | ||
}, | ||
rules: { | ||
"@typescript-eslint/no-var-requires": "off", | ||
}, | ||
}, | ||
]; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"include": [ | ||
"**/*.ts", | ||
"**/*.tsx", | ||
".next/types/**/*.ts", | ||
"eslint.config.mjs", | ||
"next.config.js", | ||
"postcss.config.js" | ||
] | ||
} |
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 |
---|---|---|
@@ -1,95 +1,119 @@ | ||
const { resolve } = require("node:path"); | ||
// @ts-check | ||
|
||
const project = resolve(process.cwd(), "tsconfig.json"); | ||
import globals from "globals"; | ||
import js from "@eslint/js"; | ||
import tseslint from "typescript-eslint"; | ||
import simpleImportSort from "eslint-plugin-simple-import-sort"; | ||
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended"; | ||
|
||
/** @type {import("eslint").Linter.Config} */ | ||
module.exports = { | ||
extends: ["eslint:recommended", "prettier", "turbo"], | ||
plugins: ["no-type-assertion", "simple-import-sort"], | ||
globals: { | ||
React: true, | ||
JSX: true, | ||
node: true, | ||
console: true, | ||
export default [ | ||
{ | ||
ignores: [ | ||
".*.js", | ||
"coverage/*", | ||
"_templates/*", | ||
"lib/*", | ||
"dist/*", | ||
"node_modules/*", | ||
], | ||
}, | ||
parserOptions: { | ||
ecmaVersion: "latest", | ||
}, | ||
env: { | ||
es6: true, | ||
}, | ||
ignorePatterns: [ | ||
// Ignore dotfiles | ||
".*.js", | ||
"node_modules/", | ||
"dist/", | ||
"lib/", | ||
], | ||
overrides: [ | ||
{ | ||
files: ["**/*.{ts,tsx}"], | ||
parser: "@typescript-eslint/parser", | ||
extends: [ | ||
"plugin:@typescript-eslint/recommended-type-checked", | ||
"plugin:@typescript-eslint/stylistic-type-checked", | ||
"prettier", | ||
], | ||
rules: { | ||
"import/prefer-default-export": "off", | ||
"no-restricted-syntax": [ | ||
"error", | ||
{ | ||
selector: "ExportDefaultDeclaration", | ||
message: "Prefer named exports", | ||
}, | ||
], | ||
"no-void": "off", | ||
"no-restricted-imports": [ | ||
"error", | ||
{ | ||
patterns: ["../*"], | ||
}, | ||
], | ||
"simple-import-sort/imports": [ | ||
"error", | ||
{ | ||
groups: [ | ||
// Side effect imports. | ||
["^\\u0000"], | ||
// Node.js builtins prefixed with `node:`. | ||
["^node:"], | ||
// Packages. `react` related packages come first. | ||
["^react", "^@?\\w"], | ||
// Internal packages. | ||
["^(@|@api|@internal|@root)(/.*|$)"], | ||
// Other relative imports. Put same-folder imports and `.` last. | ||
["^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"], | ||
// Style imports. | ||
["^.+\\.s?css$"], | ||
], | ||
}, | ||
], | ||
"simple-import-sort/exports": "error", | ||
"@typescript-eslint/consistent-type-definitions": "off", | ||
"@typescript-eslint/ban-ts-comment": "warn", | ||
"@typescript-eslint/no-unsafe-member-access": "warn", | ||
"@typescript-eslint/no-shadow": "warn", | ||
"@typescript-eslint/require-await": "warn", | ||
"@typescript-eslint/no-unsafe-assignment": "warn", | ||
"@typescript-eslint/no-unsafe-return": "warn", | ||
"@typescript-eslint/no-unsafe-call": "warn", | ||
"@typescript-eslint/no-unused-vars": [ | ||
"error", | ||
{ argsIgnorePattern: "^_" }, | ||
], | ||
"no-type-assertion/no-type-assertion": "error", | ||
|
||
// Base JS config | ||
js.configs.recommended, | ||
|
||
// Base TS config | ||
...tseslint.configs.recommended, | ||
|
||
// Prettier recommended | ||
eslintPluginPrettierRecommended, | ||
|
||
// MJS files in scripts folder (have access to ZX globals) | ||
{ | ||
files: ["**/*.mjs"], | ||
languageOptions: { | ||
globals: { | ||
...globals.node, | ||
log: true, | ||
$: true, | ||
argv: true, | ||
cd: true, | ||
chalk: true, | ||
echo: true, | ||
expBackoff: true, | ||
fs: true, | ||
glob: true, | ||
globby: true, | ||
nothrow: true, | ||
os: true, | ||
path: true, | ||
question: true, | ||
quiet: true, | ||
quote: true, | ||
quotePowerShell: true, | ||
retry: true, | ||
sleep: true, | ||
spinner: true, | ||
ssh: true, | ||
stdin: true, | ||
which: true, | ||
within: true, | ||
}, | ||
}, | ||
{ | ||
files: ["**/*.test.ts", "**/*.stub.ts"], | ||
rules: { | ||
"no-type-assertion/no-type-assertion": "off", | ||
}, | ||
}, | ||
|
||
{ | ||
files: ["**/*.ts"], | ||
plugins: { | ||
"simple-import-sort": simpleImportSort, | ||
}, | ||
rules: { | ||
"import/prefer-default-export": "off", | ||
"no-restricted-syntax": [ | ||
"error", | ||
{ | ||
selector: "ExportDefaultDeclaration", | ||
message: "Prefer named exports", | ||
}, | ||
], | ||
"no-void": "off", | ||
"no-restricted-imports": [ | ||
"error", | ||
{ | ||
patterns: ["../*"], | ||
}, | ||
], | ||
"simple-import-sort/imports": [ | ||
"error", | ||
{ | ||
groups: [ | ||
// Side effect imports. | ||
["^\\u0000"], | ||
// Node.js builtins prefixed with `node:`. | ||
["^node:"], | ||
// Packages. `react` related packages come first. | ||
["^react", "^@?\\w"], | ||
// Internal packages. | ||
["^(@|@api|@internal|@root)(/.*|$)"], | ||
// Other relative imports. Put same-folder imports and `.` last. | ||
["^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"], | ||
// Style imports. | ||
["^.+\\.s?css$"], | ||
], | ||
}, | ||
], | ||
"simple-import-sort/exports": "error", | ||
"@typescript-eslint/consistent-type-definitions": "off", | ||
"@typescript-eslint/ban-ts-comment": "warn", | ||
"@typescript-eslint/no-unsafe-member-access": "warn", | ||
"@typescript-eslint/no-shadow": "warn", | ||
"@typescript-eslint/require-await": "warn", | ||
"@typescript-eslint/no-unsafe-assignment": "warn", | ||
"@typescript-eslint/no-unsafe-return": "warn", | ||
"@typescript-eslint/no-unsafe-call": "warn", | ||
"@typescript-eslint/no-unused-vars": [ | ||
"error", | ||
{ argsIgnorePattern: "^_" }, | ||
], | ||
}, | ||
], | ||
}; | ||
}, | ||
]; |
Oops, something went wrong.