forked from rileytomasek/eslint-config
-
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.
- Loading branch information
0 parents
commit 5269976
Showing
20 changed files
with
1,015 additions
and
0 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 @@ | ||
{} |
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,126 @@ | ||
# `@remix-run/eslint-config` | ||
|
||
## 1.16.1 | ||
|
||
### Patch Changes | ||
|
||
- Don't require display name in root module ([#5450](https://github.com/remix-run/remix/pull/5450)) | ||
- Update minimum version of Babel dependencies to avoid errors parsing decorators ([#6390](https://github.com/remix-run/remix/pull/6390)) | ||
|
||
## 1.16.0 | ||
|
||
### Minor Changes | ||
|
||
- add deprecation warning to `@remix-run/eslint-config/jest` ESLint config ([#5697](https://github.com/remix-run/remix/pull/5697)) | ||
|
||
## 1.15.0 | ||
|
||
### Patch Changes | ||
|
||
- Updated TypeScript `peerDependency` to allow for `^5.0.0` ([`6b6ee66a2`](https://github.com/remix-run/remix/commit/6b6ee66a2fef1a7b00ce4c95abed144ab80017e3)) | ||
|
||
## 1.14.3 | ||
|
||
No significant changes to this package were made in this release. [See the releases page on GitHub](https://github.com/remix-run/remix/releases/tag/remix%401.14.2) for an overview of all changes in v1.14.3. | ||
|
||
## 1.14.2 | ||
|
||
No significant changes to this package were made in this release. [See the releases page on GitHub](https://github.com/remix-run/remix/releases/tag/remix%401.14.2) for an overview of all changes in v1.14.2. | ||
|
||
## 1.14.1 | ||
|
||
No significant changes to this package were made in this release. [See the releases page on GitHub](https://github.com/remix-run/remix/releases/tag/remix%401.14.1) for an overview of all changes in v1.14.1. | ||
|
||
## 1.14.0 | ||
|
||
No significant changes to this package were made in this release. [See the releases page on GitHub](https://github.com/remix-run/remix/releases/tag/remix%401.14.0) for an overview of all changes in v1.14.0. | ||
|
||
## 1.13.0 | ||
|
||
No significant changes to this package were made in this release. [See the releases page on GitHub](https://github.com/remix-run/remix/releases/tag/remix%401.13.0) for an overview of all changes in v1.13.0. | ||
|
||
## 1.12.0 | ||
|
||
No significant changes to this package were made in this release. [See the releases page on GitHub](https://github.com/remix-run/remix/releases/tag/remix%401.12.0) for an overview of all changes in v1.12.0. | ||
|
||
## 1.11.1 | ||
|
||
No significant changes to this package were made in this release. [See the releases page on GitHub](https://github.com/remix-run/remix/releases/tag/remix%401.11.1) for an overview of all changes in v1.11.1. | ||
|
||
## 1.11.0 | ||
|
||
No significant changes to this package were made in this release. [See the releases page on GitHub](https://github.com/remix-run/remix/releases/tag/remix%401.11.0) for an overview of all changes in v1.11.0. | ||
|
||
## 1.10.1 | ||
|
||
No significant changes to this package were made in this release. [See the releases page on GitHub](https://github.com/remix-run/remix/releases/tag/remix%401.10.1) for an overview of all changes in v1.10.1. | ||
|
||
## 1.10.0 | ||
|
||
No significant changes to this package were made in this release. [See the releases page on GitHub](https://github.com/remix-run/remix/releases/tag/remix%401.10.0) for an overview of all changes in v1.10.0. | ||
|
||
## 1.9.0 | ||
|
||
No significant changes to this package were made in this release. [See the releases page on GitHub](https://github.com/remix-run/remix/releases/tag/remix%401.9.0) for an overview of all changes in v1.9.0. | ||
|
||
## 1.8.2 | ||
|
||
No significant changes to this package were made in this release. [See the releases page on GitHub](https://github.com/remix-run/remix/releases/tag/remix%401.8.2) for an overview of all changes in v1.8.2. | ||
|
||
## 1.8.1 | ||
|
||
No significant changes to this package were made in this release. [See the releases page on GitHub](https://github.com/remix-run/remix/releases/tag/remix%401.8.1) for an overview of all changes in v1.8.1. | ||
|
||
## 1.8.0 | ||
|
||
### Patch Changes | ||
|
||
- Replace references to the old `migrate` command with the new `codemod` command ([#4646](https://github.com/remix-run/remix/pull/4646)) | ||
|
||
## 1.7.6 | ||
|
||
No significant changes to this package were made in this release. [See the releases page on GitHub](https://github.com/remix-run/remix/releases/tag/remix%401.7.6) for an overview of all changes in v1.7.6. | ||
|
||
## 1.7.5 | ||
|
||
No significant changes to this package were made in this release. [See the releases page on GitHub](https://github.com/remix-run/remix/releases/tag/remix%401.7.5) for an overview of all changes in v1.7.5. | ||
|
||
## 1.7.4 | ||
|
||
No significant changes to this package were made in this release. [See the releases page on GitHub](https://github.com/remix-run/remix/releases/tag/remix%401.7.4) for an overview of all changes in v1.7.4. | ||
|
||
## 1.7.3 | ||
|
||
No significant changes to this package were made in this release. [See the releases page on GitHub](https://github.com/remix-run/remix/releases/tag/remix%401.7.3) for an overview of all changes in v1.7.3. | ||
|
||
## 1.7.2 | ||
|
||
### Patch Changes | ||
|
||
- Update ESLint and plugin dependencies ([`e4ec81c77`](https://github.com/remix-run/remix/commit/e4ec81c77ef9f534450a45c9474ffba6dfd9bd24)) | ||
|
||
## 1.7.1 | ||
|
||
No significant changes to this package were made in this release. [See the releases page on GitHub](https://github.com/remix-run/remix/releases/tag/remix%401.7.1) for an overview of all changes in v1.7.1. | ||
|
||
## 1.7.0 | ||
|
||
No significant changes to this package were made in this release. [See the releases page on GitHub](https://github.com/remix-run/remix/releases/tag/remix%401.7.0) for an overview of all changes in v1.7.0. | ||
|
||
## 1.6.8 | ||
|
||
No significant changes to this package were made in this release. [See the releases page on GitHub](https://github.com/remix-run/remix/releases/tag/remix%401.6.8) for an overview of all changes in v1.6.8. | ||
|
||
## 1.6.7 | ||
|
||
No significant changes to this package were made in this release. [See the releases page on GitHub](https://github.com/remix-run/remix/releases/tag/remix%401.6.7) for an overview of all changes in v1.6.7. | ||
|
||
## 1.6.6 | ||
|
||
No significant changes to this package were made in this release. [See the releases page on GitHub](https://github.com/remix-run/remix/releases/tag/remix%401.6.6) for an overview of all changes in v1.6.6. | ||
|
||
## 1.6.5 | ||
|
||
### Patch Changes | ||
|
||
- Use `require.resolve` when importing `@babel/preset-react` ([#3716](https://github.com/remix-run/remix/pull/3716)) |
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,46 @@ | ||
# `@remix-run/eslint-config` | ||
|
||
This package includes a shareable ESLint config for Remix projects. | ||
|
||
If you create your app with `create-remix` no additional configuration is necessary. | ||
|
||
## Installation | ||
|
||
First, install this package along with ESLint in your project. **This package requires at least version 8.1 of ESLint** | ||
|
||
```sh | ||
npm install -D eslint @remix-run/eslint-config | ||
``` | ||
|
||
Then create a file named `.eslintrc.js` in the root of your project: | ||
|
||
```js filename=.eslintrc.js | ||
module.exports = { | ||
extends: "@remix-run/eslint-config", | ||
}; | ||
``` | ||
|
||
### Jest + Testing Library | ||
|
||
This packages also ships with optional configuration options for projects that use [Jest](https://jestjs.io/) with [Testing Library](https://testing-library.com). To enable these rules, add the following to your `.eslintrc`: | ||
|
||
```js filename=.eslintrc.js | ||
module.exports = { | ||
extends: [ | ||
"@remix-run/eslint-config", | ||
"@remix-run/eslint-config/jest-testing-library", | ||
], | ||
}; | ||
``` | ||
|
||
Please note that because this ruleset is optional, we do not include the core libraries as peer dependencies for this package. If you use these rules, be sure that you have the following dependencies installed in your project: | ||
|
||
```json filename=package.json | ||
{ | ||
"dependencies": { | ||
"@testing-library/jest-dom": ">=5.16.0", | ||
"@testing-library/react": ">=12.0.0", | ||
"jest": ">=26.0.0" | ||
} | ||
} | ||
``` |
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,97 @@ | ||
// Splitting rules into separate modules allow for a lower-level API if our | ||
// default rules become difficult to extend without lots of duplication. | ||
const coreRules = require("./rules/core"); | ||
const importRules = require("./rules/import"); | ||
const reactRules = require("./rules/react"); | ||
const jsxA11yRules = require("./rules/jsx-a11y"); | ||
const typescriptRules = require("./rules/typescript"); | ||
const importSettings = require("./settings/import"); | ||
const reactSettings = require("./settings/react"); | ||
|
||
/** | ||
* @see https://github.com/eslint/eslint/issues/3458 | ||
* @see https://www.npmjs.com/package/@rushstack/eslint-patch | ||
*/ | ||
require("@rushstack/eslint-patch/modern-module-resolution"); | ||
|
||
const OFF = 0; | ||
// const WARN = 1; | ||
// const ERROR = 2; | ||
|
||
/** @type {import('eslint').Linter.Config} */ | ||
const config = { | ||
parser: "@babel/eslint-parser", | ||
parserOptions: { | ||
sourceType: "module", | ||
requireConfigFile: false, | ||
ecmaVersion: "latest", | ||
babelOptions: { | ||
presets: [require.resolve("@babel/preset-react")], | ||
}, | ||
}, | ||
env: { | ||
browser: true, | ||
commonjs: true, | ||
es6: true, | ||
}, | ||
plugins: ["import", "react", "react-hooks", "jsx-a11y"], | ||
settings: { | ||
...reactSettings, | ||
...importSettings, | ||
}, | ||
|
||
// NOTE: In general - we want to use prettier for the majority of stylistic | ||
// concerns. However there are some "stylistic" eslint rules we use that should | ||
// not fail a PR since we can auto-fix them after merging to dev. These rules | ||
// should be set to WARN. | ||
// | ||
// ERROR should be used for "functional" rules that indicate a problem in the | ||
// code, and these will cause a PR failure | ||
|
||
// IMPORTANT: Ensure that rules used here are compatible with | ||
// typescript-eslint. If they are not, we need to turn the rule off in our | ||
// overrides for ts/tsx. | ||
|
||
// To read the details for any rule, see https://eslint.org/docs/rules/[RULE-KEY] | ||
rules: { | ||
...coreRules, | ||
...importRules, | ||
...reactRules, | ||
...jsxA11yRules, | ||
}, | ||
overrides: [ | ||
{ | ||
files: ["**/*.ts?(x)"], | ||
extends: ["plugin:import/typescript"], | ||
parser: "@typescript-eslint/parser", | ||
parserOptions: { | ||
sourceType: "module", | ||
ecmaVersion: 2019, | ||
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
warnOnUnsupportedTypeScriptVersion: true, | ||
}, | ||
plugins: ["@typescript-eslint"], | ||
rules: { | ||
...typescriptRules, | ||
}, | ||
}, | ||
{ | ||
files: [ | ||
"**/routes/**/*.js?(x)", | ||
"**/routes/**/*.tsx", | ||
"app/root.js?(x)", | ||
"app/root.tsx", | ||
], | ||
rules: { | ||
// Routes may use default exports without a name. At the route level | ||
// identifying components for debugging purposes is less of an issue, as | ||
// the route boundary is more easily identifiable. | ||
"react/display-name": OFF, | ||
}, | ||
}, | ||
], | ||
}; | ||
|
||
module.exports = 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/** | ||
* This config is intended for internal Remix projects. It should not be | ||
* documented nor considered public API in regard to semver considerations. | ||
*/ | ||
|
||
/** | ||
* @see https://github.com/eslint/eslint/issues/3458 | ||
* @see https://www.npmjs.com/package/@rushstack/eslint-patch | ||
*/ | ||
require("@rushstack/eslint-patch/modern-module-resolution"); | ||
|
||
const OFF = 0; | ||
const WARN = 1; | ||
const ERROR = 2; | ||
|
||
/** @type {import('eslint').Linter.Config} */ | ||
module.exports = { | ||
root: true, | ||
extends: [ | ||
require.resolve("./index.js"), | ||
require.resolve("./jest-testing-library.js"), | ||
], | ||
env: { | ||
node: true, | ||
}, | ||
plugins: [ | ||
// Plugins used in the internal config should be installed in our | ||
// repositories. We don't want to ship these as dependencies to consumers | ||
// who may not use them. | ||
"node", | ||
"prefer-let", | ||
], | ||
rules: { | ||
"@typescript-eslint/consistent-type-imports": ERROR, | ||
"import/order": [ | ||
ERROR, | ||
{ | ||
"newlines-between": "always", | ||
groups: [ | ||
["builtin", "external"], | ||
"internal", | ||
["parent", "sibling", "index"], | ||
], | ||
}, | ||
], | ||
"jest/no-disabled-tests": OFF, | ||
"prefer-let/prefer-let": WARN, | ||
}, | ||
overrides: [ | ||
{ | ||
// all code blocks in .md files | ||
files: ["**/*.md/*.js?(x)", "**/*.md/*.ts?(x)"], | ||
rules: { | ||
"no-unreachable": OFF, | ||
"no-unused-expressions": OFF, | ||
"no-unused-labels": OFF, | ||
"no-unused-vars": OFF, | ||
"prefer-const": WARN, | ||
"jsx-a11y/alt-text": OFF, | ||
"jsx-a11y/anchor-has-content": OFF, | ||
"prefer-let/prefer-let": OFF, | ||
"react/jsx-no-comment-textnodes": OFF, | ||
"react/jsx-no-undef": OFF, | ||
}, | ||
}, | ||
{ | ||
// all ```ts & ```tsx code blocks in .md files | ||
files: ["**/*.md/*.ts?(x)"], | ||
rules: { | ||
"@typescript-eslint/no-unused-expressions": OFF, | ||
"@typescript-eslint/no-unused-vars": OFF, | ||
}, | ||
}, | ||
{ | ||
files: ["packages/**/*.*"], | ||
excludedFiles: "**/__tests__/**/*.*", | ||
rules: { | ||
// Validate dependencies are listed in workspace package.json files | ||
"import/no-extraneous-dependencies": ERROR, | ||
}, | ||
}, | ||
{ | ||
files: ["integration/**/*.*"], | ||
env: { | ||
"jest/globals": false, | ||
}, | ||
}, | ||
], | ||
}; |
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,29 @@ | ||
const jestRules = require("./rules/jest"); | ||
const jestDomRules = require("./rules/jest-dom"); | ||
const testingLibraryRules = require("./rules/testing-library"); | ||
|
||
/** | ||
* @see https://github.com/eslint/eslint/issues/3458 | ||
* @see https://www.npmjs.com/package/@rushstack/eslint-patch | ||
*/ | ||
require("@rushstack/eslint-patch/modern-module-resolution"); | ||
|
||
module.exports = { | ||
plugins: ["jest", "jest-dom", "testing-library"], | ||
env: { | ||
node: true, | ||
}, | ||
overrides: [ | ||
{ | ||
files: ["**/__tests__/**/*", "**/*.{spec,test}.*"], | ||
env: { | ||
"jest/globals": true, | ||
}, | ||
rules: { | ||
...jestRules, | ||
...jestDomRules, | ||
...testingLibraryRules, | ||
}, | ||
}, | ||
], | ||
}; |
Oops, something went wrong.