-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify ESLint configuration (#172)
- Loading branch information
1 parent
2d906ec
commit db01323
Showing
11 changed files
with
176 additions
and
83 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 |
---|---|---|
@@ -1,22 +1,140 @@ | ||
/** @type {import('@types/eslint').Linter.BaseConfig} */ | ||
/** | ||
* This is intended to be a basic starting point for linting in the Grunge Stack. | ||
* It relies on recommended configs out of the box for simplicity, but you can | ||
* and should modify this configuration to best suit your team's needs. | ||
*/ | ||
|
||
/** @type {import('eslint').Linter.Config} */ | ||
module.exports = { | ||
root: true, | ||
extends: [ | ||
"@remix-run/eslint-config", | ||
"@remix-run/eslint-config/node", | ||
"@remix-run/eslint-config/jest-testing-library", | ||
"prettier", | ||
], | ||
parserOptions: { | ||
ecmaVersion: "latest", | ||
sourceType: "module", | ||
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
}, | ||
env: { | ||
"cypress/globals": true, | ||
browser: true, | ||
commonjs: true, | ||
es6: true, | ||
}, | ||
plugins: ["cypress"], | ||
// We're using vitest which has a very similar API to jest | ||
// (so the linting plugins work nicely), but it means we | ||
// have to set the jest version explicitly. | ||
settings: { | ||
jest: { | ||
version: 28, | ||
|
||
// Base config | ||
extends: ["eslint:recommended"], | ||
|
||
overrides: [ | ||
// React | ||
{ | ||
files: ["**/*.{js,jsx,ts,tsx}"], | ||
plugins: ["react", "jsx-a11y"], | ||
extends: [ | ||
"plugin:react/recommended", | ||
"plugin:react/jsx-runtime", | ||
"plugin:jsx-a11y/recommended", | ||
"prettier", | ||
], | ||
settings: { | ||
react: { | ||
version: "detect", | ||
}, | ||
formComponents: ["Form"], | ||
linkComponents: [ | ||
{ name: "Link", linkAttribute: "to" }, | ||
{ name: "NavLink", linkAttribute: "to" }, | ||
], | ||
}, | ||
rules: { | ||
"react/jsx-no-leaked-render": [ | ||
"warn", | ||
{ validStrategies: ["ternary"] }, | ||
], | ||
}, | ||
}, | ||
}, | ||
|
||
// Typescript | ||
{ | ||
files: ["**/*.{ts,tsx}"], | ||
plugins: ["@typescript-eslint", "import"], | ||
parser: "@typescript-eslint/parser", | ||
settings: { | ||
"import/internal-regex": "^~/", | ||
"import/resolver": { | ||
node: { | ||
extensions: [".ts", ".tsx"], | ||
}, | ||
typescript: { | ||
alwaysTryTypes: true, | ||
}, | ||
}, | ||
}, | ||
extends: [ | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:@typescript-eslint/stylistic", | ||
"plugin:import/recommended", | ||
"plugin:import/typescript", | ||
"prettier", | ||
], | ||
rules: { | ||
"import/order": [ | ||
"error", | ||
{ | ||
alphabetize: { caseInsensitive: true, order: "asc" }, | ||
groups: ["builtin", "external", "internal", "parent", "sibling"], | ||
"newlines-between": "always", | ||
}, | ||
], | ||
}, | ||
}, | ||
|
||
// Markdown | ||
{ | ||
files: ["**/*.md"], | ||
plugins: ["markdown"], | ||
extends: ["plugin:markdown/recommended", "prettier"], | ||
}, | ||
|
||
// Jest/Vitest | ||
{ | ||
files: ["**/*.test.{js,jsx,ts,tsx}"], | ||
plugins: ["jest", "jest-dom", "testing-library"], | ||
extends: [ | ||
"plugin:jest/recommended", | ||
"plugin:jest-dom/recommended", | ||
"plugin:testing-library/react", | ||
"prettier", | ||
], | ||
env: { | ||
"jest/globals": true, | ||
}, | ||
settings: { | ||
jest: { | ||
// we're using vitest which has a very similar API to jest | ||
// (so the linting plugins work nicely), but it means we have to explicitly | ||
// set the jest version. | ||
version: 28, | ||
}, | ||
}, | ||
}, | ||
|
||
// Cypress | ||
{ | ||
files: ["cypress/**/*.ts"], | ||
plugins: ["cypress"], | ||
extends: ["plugin:cypress/recommended", "prettier"], | ||
}, | ||
|
||
// Node | ||
{ | ||
files: [ | ||
".eslintrc.js", | ||
"plugin-remix.js", | ||
"remix.config.js", | ||
"mocks/**/*.js", | ||
], | ||
env: { | ||
node: true, | ||
}, | ||
}, | ||
], | ||
}; |
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 |
---|---|---|
|
@@ -30,4 +30,4 @@ jobs: | |
run: npm install | ||
|
||
- name: 🔬 Lint | ||
run: npm run lint:repo | ||
run: npm run lint |
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.