-
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.
There is a technically “breaking change” in here, but I know no-one is using the undocumented preferredAlias options yet.
- Loading branch information
Showing
16 changed files
with
306 additions
and
36 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 |
---|---|---|
|
@@ -9,7 +9,7 @@ node_modules | |
build | ||
cache | ||
public/static | ||
docs | ||
./docs | ||
lib | ||
dist | ||
config/local.* | ||
|
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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 @@ | ||
const prettier = require('prettier'); | ||
|
||
/** @type {import('eslint-doc-generator').GenerateOptions} */ | ||
const config = { | ||
postprocess: async (content, path) => { | ||
const prettierRC = await prettier.resolveConfig(path); | ||
return prettier.format(content, { ...prettierRC, parser: 'markdown' }); | ||
}, | ||
}; | ||
|
||
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 |
---|---|---|
@@ -1,18 +1,12 @@ | ||
{ | ||
"extends": ["../../.eslintrc.js"], | ||
"ignorePatterns": ["!**/*"], | ||
"overrides": [ | ||
{ | ||
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.ts", "*.tsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.js", "*.jsx"], | ||
"rules": {} | ||
} | ||
] | ||
"parserOptions": { | ||
"sourceType": "script" | ||
}, | ||
"extends": ["../../.eslintrc.js", "plugin:eslint-plugin/recommended"], | ||
"rules": { | ||
"eslint-plugin/require-meta-docs-url": "error", | ||
"eslint-plugin/require-meta-docs-description": "error", | ||
"eslint-plugin/require-meta-schema": "error" | ||
} | ||
} |
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,3 +1,30 @@ | ||
This eslint-plugin is used internally in the eslint-config. | ||
# @tablecheck/eslint-plugins | ||
|
||
Custom rules must be done in a plugin and cannot be done in an eslint-config by default, plugins must be separate packages. | ||
This repository contains custom eslint plugins that can be used to enforce coding standards and best practices in your JavaScript projects. | ||
|
||
These rules were written for code consistency in our Frontend Team at [TableCheck](https://www.tablecheck.com/en/join/). | ||
|
||
Learn more about [TableCheck](https://www.tablecheck.com/en/join/) and check out our [Careers page](https://careers.tablecheck.com). | ||
|
||
## Installation | ||
|
||
To install the plugins, run the following command: | ||
|
||
```sh | ||
npm install --save-dev @tablecheck/eslint-plugin | ||
``` | ||
|
||
## Rules | ||
|
||
<!-- begin auto-generated rules list --> | ||
|
||
🔧 Automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--fix).\ | ||
💭 Requires type information. | ||
|
||
| Name | Description | 🔧 | 💭 | | ||
| :--------------------------------------------------------------- | :------------------------------------------------------------------------------------------ | :-- | :-- | | ||
| [consistent-react-import](docs/rules/consistent-react-import.md) | Ensure that react is always imported and used consistently | 🔧 | | | ||
| [forbidden-imports](docs/rules/forbidden-imports.md) | Ensure that certain packages are using specific imports instead of using the default import | 🔧 | | | ||
| [prefer-shortest-import](docs/rules/prefer-shortest-import.md) | Enforce the consistent use of preferred import paths | 🔧 | 💭 | | ||
|
||
<!-- end auto-generated rules list --> |
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,5 @@ | ||
# Ensure that react is always imported and used consistently (`@tablecheck/consistent-react-import`) | ||
|
||
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). | ||
|
||
<!-- end auto-generated rule header --> |
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,5 @@ | ||
# Ensure that certain packages are using specific imports instead of using the default import (`@tablecheck/forbidden-imports`) | ||
|
||
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). | ||
|
||
<!-- end auto-generated rule header --> |
17 changes: 17 additions & 0 deletions
17
packages/eslint-plugin/docs/rules/prefer-shortest-import.md
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,17 @@ | ||
# Enforce the consistent use of preferred import paths (`@tablecheck/prefer-shortest-import`) | ||
|
||
🔧 This rule is automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix). | ||
|
||
💭 This rule requires type information. | ||
|
||
<!-- end auto-generated rule header --> | ||
|
||
## Options | ||
|
||
<!-- begin auto-generated rule options list --> | ||
|
||
| Name | Description | Type | | ||
| :--------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------- | | ||
| `preferredAlias` | A list of alias paths to prefer over relative paths, for example, providing `["~/utils"]` will prefer `~/utils/useSomething` over `../useSomething` or `./useSomething` | String[] | | ||
|
||
<!-- end auto-generated rule options list --> |
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.