-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add eslint and update linting issues
- Loading branch information
1 parent
0fcfaa8
commit a44a57d
Showing
43 changed files
with
185 additions
and
842 deletions.
There are no files selected for viewing
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,123 @@ | ||
const { resolve } = require("node:path") | ||
|
||
const project = resolve(process.cwd(), "tsconfig.json") | ||
|
||
/** @type {import('eslint').Linter.Config} */ | ||
module.exports = { | ||
root: true, | ||
parserOptions: { | ||
ecmaVersion: "latest", | ||
sourceType: "module", | ||
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
}, | ||
env: { | ||
browser: true, | ||
commonjs: true, | ||
es6: true, | ||
}, | ||
|
||
// Base config | ||
extends: ["eslint:recommended"], | ||
|
||
// Ignore | ||
ignorePatterns: ["node_modules", "/dist"], | ||
|
||
overrides: [ | ||
// General | ||
{ | ||
files: ["*.js?(x)", "*.ts?(x)"], | ||
extends: ["eslint:recommended", "eslint-config-turbo", "prettier"], | ||
}, | ||
|
||
// React | ||
{ | ||
files: ["*.js?(x)", "*.ts?(x)"], | ||
plugins: ["react", "react-refresh", "jsx-a11y"], | ||
extends: [ | ||
"plugin:react/recommended", | ||
"plugin:react/jsx-runtime", | ||
"plugin:react-hooks/recommended", | ||
"plugin:jsx-a11y/recommended", | ||
], | ||
settings: { | ||
react: { | ||
version: "detect", | ||
}, | ||
formComponents: ["Form"], | ||
linkComponents: [ | ||
{ name: "Link", linkAttribute: "to" }, | ||
{ name: "NavLink", linkAttribute: "to" }, | ||
], | ||
}, | ||
rules: { | ||
"react-refresh/only-export-components": ["warn", { allowExportNames: ["metadata"] }], | ||
"react/display-name": "off", | ||
"react-hooks/exhaustive-deps": "off", | ||
"jsx-a11y/heading-has-content": "off", | ||
"jsx-a11y/anchor-has-content": "off", | ||
"jsx-a11y/control-has-associated-label": "off", | ||
}, | ||
}, | ||
|
||
// Typescript | ||
{ | ||
files: ["*.ts?(x)"], | ||
plugins: ["@typescript-eslint", "import"], | ||
parser: "@typescript-eslint/parser", | ||
extends: [ | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:@typescript-eslint/stylistic", | ||
"plugin:import/recommended", | ||
"plugin:import/typescript", | ||
], | ||
settings: { | ||
"import/internal-regex": "^~/", | ||
"import/resolver": { | ||
typescript: { | ||
project, | ||
alwaysTryTypes: true, | ||
}, | ||
node: { | ||
extensions: [".ts", ".tsx"], | ||
}, | ||
}, | ||
}, | ||
rules: { | ||
"import/namespace": [2, { allowComputed: true }], | ||
"import/order": [ | ||
"error", | ||
{ | ||
alphabetize: { caseInsensitive: true, order: "asc" }, | ||
groups: ["builtin", "external", "internal", "parent", "sibling"], | ||
"newlines-between": "always", | ||
}, | ||
], | ||
"@typescript-eslint/no-unused-vars": [ | ||
"warn", | ||
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" }, | ||
], | ||
"@typescript-eslint/consistent-type-imports": [ | ||
"warn", | ||
{ prefer: "type-imports", fixStyle: "separate-type-imports" }, | ||
], | ||
"@typescript-eslint/consistent-type-definitions": ["error", "type"], | ||
"@typescript-eslint/no-unsafe-call": "off", | ||
"@typescript-eslint/no-unsafe-argument": "off", | ||
"@typescript-eslint/no-unsafe-assignment": "off", | ||
"@typescript-eslint/no-unsafe-return": "off", | ||
"@typescript-eslint/no-unsafe-member-access": "off", | ||
"@typescript-eslint/no-explicit-any": "off", | ||
}, | ||
}, | ||
|
||
// Node | ||
{ | ||
files: [".eslintrc.js", "mocks/**/*.js"], | ||
env: { | ||
node: true, | ||
}, | ||
}, | ||
], | ||
} |
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,14 +1,18 @@ | ||
/** @type {import("prettier").Config} */ | ||
import { fileURLToPath } from "url" | ||
|
||
/** @typedef {import("prettier").Config} PrettierConfig */ | ||
/** @typedef {import("prettier-plugin-tailwindcss").PluginOptions} TailwindConfig */ | ||
|
||
/** @type { PrettierConfig | TailwindConfig } */ | ||
const config = { | ||
jsxSingleQuote: false, | ||
singleQuote: false, | ||
semi: false, | ||
trailingComma: "all", | ||
tabWidth: 2, | ||
printWidth: 100, | ||
importOrder: ["^react$", "<THIRD_PARTY_MODULES>", "^~/(.*)$", "^[./]"], | ||
importOrderSortSpecifiers: true, | ||
plugins: ["@trivago/prettier-plugin-sort-imports"], | ||
plugins: ["prettier-plugin-tailwindcss"], | ||
tailwindConfig: fileURLToPath(new URL("tailwind.config.js", import.meta.url)), | ||
} | ||
|
||
export default config |
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 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
Oops, something went wrong.