-
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-plugin-curology config (#4)
* Update README, pull in eslint-config-curology index.js * Add bad wip * Bump all peerDeps to latest * Remove curology rules, add id-length as no-single-letter-variable replacement * Export config under recommended key, set node to 16 * Add eslint:recommended to recommended config * Update README to reflect recommended key
- Loading branch information
1 parent
44be820
commit 279fbca
Showing
6 changed files
with
100 additions
and
1,441 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
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,45 +1,25 @@ | ||
# eslint-plugin-curology | ||
|
||
Custom ESlint rules for Curology | ||
[Shareable Config](https://eslint.org/docs/developer-guide/shareable-configs) used at [Curology](https://curology.com/). | ||
|
||
(Set up as a plugin for any custom rules we want to write in the future.) | ||
|
||
## Installation | ||
|
||
You'll first need to install [ESLint](http://eslint.org): | ||
|
||
``` | ||
$ npm i eslint --save-dev | ||
``` | ||
|
||
Next, install `eslint-plugin-curology`: | ||
|
||
``` | ||
$ npm install eslint-plugin-curology --save-dev | ||
$ yarn add eslint eslint-plugin-curology --dev | ||
``` | ||
|
||
**Note:** If you installed ESLint globally (using the `-g` flag) then you must also install `eslint-plugin-curology` globally. | ||
|
||
## Usage | ||
### Usage (Config) | ||
|
||
Add `curology` to the plugins section of your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix: | ||
To enable this configuration use the `extends` property in your `.eslintrc` config file: | ||
|
||
```json | ||
{ | ||
"plugins": [ | ||
"curology" | ||
] | ||
} | ||
``` | ||
|
||
Then configure the rules you want to use under the rules section. | ||
|
||
```json | ||
{ | ||
"rules": { | ||
"curology/rule-name": 2 | ||
} | ||
"extends": [...otherConfig, "plugin:curology/recommended"] | ||
} | ||
``` | ||
|
||
## Supported Rules | ||
|
||
There are no custom rules at the moment. | ||
`"plugin:curology/recommended"` must be the last entry in "extends" for best [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier/blob/1f206661b8e197e6753b772509028c34f954b42a/README.md#recommended-configuration) compatibility, |
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,73 @@ | ||
/** | ||
* TODO: If more distinct rulesets are needed, e.g. `plugin:curology/jest`, | ||
* `plugin:curology/react`, we can expand on the exported config keys. | ||
*/ | ||
const recommended = { | ||
extends: [ | ||
"airbnb", | ||
"eslint/recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:prettier/recommended", | ||
], | ||
parser: "@typescript-eslint/parser", | ||
rules: { | ||
"@typescript-eslint/prefer-ts-expect-error": 2, | ||
"arrow-parens": [2, "as-needed"], | ||
"class-methods-use-this": 0, | ||
"comma-dangle": [2, "always-multiline"], | ||
"consistent-return": 0, | ||
"func-names": 0, | ||
"function-paren-newline": 0, | ||
"global-require": 0, | ||
"id-length": 2, | ||
"import/extensions": ["error", "never"], | ||
"import/no-cycle": 1, | ||
"import/no-named-as-default-member": 1, | ||
"import/no-unresolved": 0, | ||
"import/order": [ | ||
2, | ||
{ | ||
groups: [["builtin", "external"], "internal", ["parent", "sibling"]], | ||
"newlines-between": "always", | ||
}, | ||
], | ||
"import/prefer-default-export": 0, | ||
"import/no-extraneous-dependencies": [2, { devDependencies: true }], | ||
indent: 0, | ||
"jsx-a11y/anchor-is-valid": 1, | ||
"jsx-a11y/click-events-have-key-events": 1, | ||
"jsx-a11y/img-redundant-alt": 1, | ||
"jsx-a11y/no-static-element-interactions": 1, | ||
"jsx-a11y/accessible-emoji": 1, | ||
"max-len": 0, | ||
"no-confusing-arrow": 0, | ||
"no-console": 2, | ||
"no-else-return": 1, | ||
"no-plusplus": 1, | ||
"no-static-element-interactions": 0, | ||
"no-underscore-dangle": 1, | ||
"object-curly-newline": 0, | ||
"object-property-newline": [ | ||
"error", | ||
{ allowAllPropertiesOnSameLine: true }, | ||
], | ||
"react/jsx-filename-extension": [1, { extensions: [".js", ".jsx"] }], | ||
"react/jsx-fragments": [2, "element"], | ||
"react/jsx-key": 2, | ||
"react/jsx-one-expression-per-line": 0, | ||
"react/jsx-wrap-multilines": 0, | ||
"react/no-array-index-key": 1, | ||
"react/require-default-props": 2, | ||
"react/sort-comp": 0, | ||
"space-before-function-paren": 0, | ||
}, | ||
settings: { | ||
"import/extensions": [".js", ".jsx", ".ts", ".tsx"], | ||
}, | ||
}; | ||
|
||
module.exports = { | ||
configs: { | ||
recommended, | ||
}, | ||
}; |
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"name": "eslint-plugin-curology", | ||
"version": "0.1.0", | ||
"description": "Custom ESlint rules for Curology", | ||
"description": "ESLint Plugin and Configuration for Curology", | ||
"author": "Curology <[email protected]>", | ||
"keywords": [ | ||
"eslint", | ||
|
@@ -21,8 +21,22 @@ | |
}, | ||
"homepage": "https://github.com/PocketDerm/eslint-plugin-curology", | ||
"engines": { | ||
"node": ">=0.10.0" | ||
"node": "16.x" | ||
}, | ||
"main": "lib/index.js", | ||
"dependencies": {} | ||
"main": "index.js", | ||
"peerDependencies": { | ||
"@typescript-eslint/eslint-plugin": "^5.16.0", | ||
"@typescript-eslint/parser": "^5.16.0", | ||
"eslint": "^8.11.0", | ||
"eslint-config-airbnb": "^19.0.4", | ||
"eslint-config-prettier": "^8.1.0", | ||
"eslint-import-resolver-webpack": "^0.13.0", | ||
"eslint-plugin-curology": "^0.1.0", | ||
"eslint-plugin-import": "^2.22.1", | ||
"eslint-plugin-jest": "^26.1.2", | ||
"eslint-plugin-jsx-a11y": "^6.4.1", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"eslint-plugin-react": "^7.22.0", | ||
"eslint-plugin-react-hooks": "^4.2.0" | ||
} | ||
} |
Oops, something went wrong.