-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Packages: Extract Eslint config package
- Loading branch information
Showing
8 changed files
with
173 additions
and
105 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
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,24 @@ | ||
# Eslint Config | ||
|
||
[Eslint](https://eslint.org/) config for WordPress development. | ||
|
||
## Installation | ||
|
||
Install the module | ||
|
||
```bash | ||
npm install @wordpress/eslint-config --save-dev | ||
``` | ||
|
||
### Usage | ||
|
||
Next, extend the configuration from your project's `.eslintrc` file: | ||
|
||
```json | ||
"extends": "@wordpress/eslint-config" | ||
``` | ||
|
||
Refer to the [ESLint documentation on Shareable Configs](http://eslint.org/docs/developer-guide/shareable-configs) for more information. | ||
|
||
|
||
<br/><br/><p align="center"><img src="https://s.w.org/style/images/codeispoetry.png?1" alt="Code is Poetry." /></p> |
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,7 @@ | ||
module.exports = { | ||
env: { | ||
es6: true, | ||
}, | ||
|
||
rules: require( './rules/esnext' ), | ||
}; |
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,66 @@ | ||
// see https://eslint.org/docs/rules/#ecmascript-6 | ||
// | ||
module.exports = { | ||
// require braces around arrow function bodies | ||
'arrow-body-style': 'off', | ||
// require parentheses around arrow function arguments | ||
'arrow-parens': 'off', | ||
// enforce consistent spacing before and after the arrow in arrow functions | ||
'arrow-spacing': 'off', | ||
// require super() calls in constructors | ||
'constructor-super': 'error', | ||
// enforce consistent spacing around * operators in generator functions | ||
'generator-star-spacing': 'off', | ||
// disallow reassigning class members | ||
'no-class-assign': 'off', | ||
// disallow arrow functions where they could be confused with comparisons | ||
'no-confusing-arrow': 'off', | ||
// disallow reassigning `const` variables | ||
'no-const-assign': 'error', | ||
// disallow duplicate class members | ||
'no-dupe-class-members': 'error', | ||
// disallow duplicate module imports | ||
'no-duplicate-imports': 'error', | ||
// disallow `new` operators with the `Symbol` object | ||
'no-new-symbol': 'off', | ||
// disallow specified modules when loaded by `import` | ||
'no-restricted-imports': 'off', | ||
// disallow `this`/`super` before calling `super()` in constructors | ||
'no-this-before-super': 'off', | ||
// disallow unnecessary computed property keys in object literals | ||
'no-useless-computed-key': 'error', | ||
// disallow unnecessary constructors | ||
'no-useless-constructor': 'error', | ||
// disallow renaming import, export, and destructured assignments to the same name | ||
'no-useless-rename': 'off', | ||
// require `let` or `const` instead of `var` | ||
'no-var': 'error', | ||
// require or disallow method and property shorthand syntax for object literals | ||
'object-shorthand': 'off', | ||
// require arrow functions as callbacks | ||
'prefer-arrow-callback': 'off', | ||
// require `const` declarations for variables that are never reassigned after declared | ||
'prefer-const': 'error', | ||
// require destructuring from arrays and/or objects | ||
'prefer-destructuring': 'off', | ||
// disallow `parseInt()` and `Number.parseInt()` in favor of binary, octal, and hexadecimal literals | ||
'prefer-numeric-literals': 'off', | ||
// require rest parameters instead of `arguments` | ||
'prefer-rest-params': 'off', | ||
// require spread operators instead of `.apply()` | ||
'prefer-spread': 'off', | ||
// require template literals instead of string concatenation | ||
'prefer-template': 'off', | ||
// require generator functions to contain `yield` | ||
'require-yield': 'off', | ||
// enforce spacing between rest and spread operators and their expressions | ||
'rest-spread-spacing': 'off', | ||
// enforce sorted import declarations within modules | ||
'sort-imports': 'off', | ||
// require symbol descriptions | ||
'symbol-description': 'off', | ||
// require or disallow spacing around embedded expressions of template strings | ||
'template-curly-spacing': [ 'error', 'always' ], | ||
// require or disallow spacing around the `*` in `yield*` expressions | ||
'yield-star-spacing': 'off', | ||
}; |
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.