-
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 672de6c
Showing
8 changed files
with
250 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,126 @@ | ||
module.exports = { | ||
rules: { | ||
'array-bracket-newline': [2, 'consistent'], | ||
'array-bracket-spacing': 2, | ||
'array-element-newline': [2, 'consistent'], | ||
'block-scoped-var': 2, | ||
'block-spacing': 2, | ||
'brace-style': [2, '1tbs', { allowSingleLine: true }], | ||
'camelcase': 2, | ||
'comma-spacing': 2, | ||
'comma-style': 2, | ||
'complexity': 1, | ||
'computed-property-spacing': 2, | ||
'curly': 2, | ||
'dot-location': [2, 'property'], | ||
'dot-notation': 2, | ||
'eol-last': 2, | ||
'eqeqeq': 2, | ||
'func-call-spacing': 2, | ||
'function-call-argument-newline': [2, 'consistent'], | ||
'function-paren-newline': [2, 'consistent'], | ||
'guard-for-in': 2, | ||
'indent': [2, 'tab', { SwitchCase: 1 }], | ||
'key-spacing': 2, | ||
'keyword-spacing': 2, | ||
'linebreak-style': 2, | ||
'max-depth': [1, { 'max': 10 }], | ||
'max-lines-per-function': [1, { max: 100, skipBlankLines: true, skipComments: true }], | ||
'max-nested-callbacks': [1, { max: 8 }], | ||
'max-params': [1, { 'max': 8 }], | ||
'new-cap': 2, | ||
'new-parens': 2, | ||
'no-array-constructor': 2, | ||
'no-bitwise': 2, | ||
'no-caller': 2, | ||
'no-catch-shadow': 2, | ||
'no-constructor-return': 2, | ||
'no-else-return': [2, { allowElseIf: false }], | ||
'no-empty': [2, { allowEmptyCatch: true }], | ||
'no-empty-function': 2, | ||
'no-eval': 2, | ||
'no-extra-bind': 2, | ||
'no-extra-label': 2, | ||
'no-extra-parens': [2, 'all', { nestedBinaryExpressions: false, enforceForArrowConditionals: true }], | ||
'no-floating-decimal': 2, | ||
'no-implicit-coercion': [2, { boolean: false }], | ||
'no-implied-eval': 2, | ||
'no-lone-blocks': 2, | ||
'no-lonely-if': 2, | ||
'no-loop-func': 2, | ||
'no-mixed-operators': 2, | ||
'no-mixed-requires': [2, { allowCall: false }], | ||
'no-mixed-spaces-and-tabs': [2, 'smart-tabs'], | ||
'no-multi-spaces': [2, { exceptions: { Property: false } }], | ||
'no-multiple-empty-lines': [2, { max: 1 }], | ||
'no-nested-ternary': 2, | ||
'no-new': 2, | ||
'no-new-func': 2, | ||
'no-new-object': 2, | ||
'no-new-require': 2, | ||
'no-new-wrappers': 2, | ||
'no-octal': 2, | ||
'no-proto': 2, | ||
'no-redeclare': 2, | ||
'no-return-assign': 2, | ||
'no-self-compare': 2, | ||
'no-sequences': 2, | ||
'no-shadow': [1, { builtinGlobals: true }], | ||
'no-shadow-restricted-names': 2, | ||
'no-throw-literal': 2, | ||
'no-trailing-spaces': 2, | ||
'no-undef-init': 2, | ||
'no-unmodified-loop-condition': 2, | ||
'no-unneeded-ternary': [2, { defaultAssignment: false }], | ||
'no-unused-expressions': 2, | ||
'no-unsafe-negation': [2, { enforceForOrderingRelations: true }], | ||
'no-use-before-define': [2, { functions: false, variables: false }], | ||
'no-useless-call': 2, | ||
'no-useless-concat': 2, | ||
'no-useless-return': 2, | ||
'no-whitespace-before-property': 2, | ||
'object-curly-newline': [2, { multiline: true, consistent: true }], | ||
'object-curly-spacing': [2, 'always'], | ||
'object-property-newline': [2, { allowAllPropertiesOnSameLine: true }], | ||
'one-var-declaration-per-line': 2, | ||
'operator-assignment': 2, | ||
'operator-linebreak': 2, | ||
'padded-blocks': [2, 'never'], | ||
'prefer-promise-reject-errors': 2, | ||
'quote-props': [2, 'consistent'], | ||
'quotes': [2, 'single', { avoidEscape: true, allowTemplateLiterals: true }], | ||
'radix': 2, | ||
'require-jsdoc': [2, { require: { ClassDeclaration: true, MethodDefinition: true } }], | ||
'semi': 2, | ||
'semi-spacing': 2, | ||
'semi-style': 2, | ||
'space-before-blocks': 2, | ||
'space-before-function-paren': [2, { anonymous: 'always', named: 'never', asyncArrow: 'always' }], | ||
'space-in-parens': 2, | ||
'space-infix-ops': 2, | ||
'space-unary-ops': 2, | ||
// The //////// allows for the 10-slash delimiter we use in Angular controllers. | ||
'spaced-comment': [2, 'always', { block: { balanced: true }, line: { exceptions: ['/'] } }], | ||
'switch-colon-spacing': 2, | ||
'use-isnan': [2, { enforceForIndexOf: true }], | ||
'valid-jsdoc': [ | ||
2, | ||
{ | ||
matchDescription: '\\.$', | ||
preferType: { | ||
function: 'Function', | ||
boolean: 'Boolean', | ||
number: 'Number', | ||
integer: 'Number', | ||
int: 'Number', | ||
string: 'String', | ||
object: 'Object' | ||
}, | ||
requireParamType: true, | ||
requireReturn: false | ||
} | ||
], | ||
'wrap-iife': [2, 'inside', { functionPrototypeMethods: true }], | ||
'yoda': 2, | ||
} | ||
}; |
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,44 @@ | ||
module.exports = { | ||
parserOptions: { | ||
'ecmaVersion': 10, // 2019 | ||
}, | ||
env: { | ||
'es6': true, | ||
}, | ||
rules: { | ||
'arrow-parens': [2, 'as-needed', { requireForBlockBody: true }], | ||
'arrow-spacing': 2, | ||
'class-methods-use-this': 1, | ||
'computed-property-spacing': [2, 'never', { enforceForClassMembers: true }], | ||
'consistent-this': [2, 'self'], | ||
'default-param-last': 2, | ||
'generator-star-spacing': [2, { before: false, after: true }], | ||
'implicit-arrow-linebreak': 2, | ||
'lines-between-class-members': 2, | ||
'no-buffer-constructor': 2, | ||
'no-confusing-arrow': 2, | ||
'no-duplicate-imports': [2, { includeExports: true }], | ||
'no-template-curly-in-string': 2, | ||
'no-useless-computed-key': 2, | ||
'no-useless-constructor': 2, | ||
'no-useless-rename': 2, | ||
'no-var': 2, | ||
'object-shorthand': 1, | ||
'prefer-const': [2, { destructuring: 'all' }], | ||
'prefer-exponentiation-operator': 2, | ||
'prefer-numeric-literals': 2, | ||
'prefer-object-spread': 2, | ||
'prefer-rest-params': 2, | ||
'prefer-spread': 2, | ||
// Turning this off due to its aggressive positives and a pending open issue: https://github.com/eslint/eslint/issues/11899 | ||
// It is part of eslint:recommended, so we need to explicitly disable it rather than just removing it. | ||
'require-atomic-updates': 0, | ||
'require-yield': 2, | ||
'rest-spread-spacing': 2, | ||
'strict': [2, 'global'], | ||
'symbol-description': 2, | ||
'template-curly-spacing': 2, | ||
'template-tag-spacing': 2, | ||
'yield-star-spacing': 2, | ||
} | ||
}; |
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,18 @@ | ||
/* eslint-version 6.8 */ | ||
module.exports = { | ||
root: true, | ||
parserOptions: { | ||
sourceType: 'script', | ||
}, | ||
plugins: [ | ||
'jest', | ||
], | ||
extends: [ | ||
'eslint:recommended', | ||
'.eslintrc-base.js', | ||
'.eslintrc-es6plus.js', | ||
], | ||
env: { | ||
'node': true, | ||
} | ||
}; |
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 @@ | ||
/.idea/ |
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,2 @@ | ||
## 6.8-r0 / 2020-12-20 | ||
* Add baseline rules for the last ESLint version to support Node.js 8 LTS. |
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 @@ | ||
Copyright 2020 Chris Harwood <[email protected]> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
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,19 @@ | ||
# ESLint Rules | ||
These are the ESLint rules I prefer. They're split into files to make it easy to use different sets of rules depending on what components the project has and what versions it expects. | ||
|
||
## Versions | ||
These rules are configured to be used with the following versions. | ||
|
||
| Name | Version | Notes | | ||
|------|---------|-------------| | ||
| [ESLint](https://eslint.org/) | [6.8.0](https://eslint.org/blog/2019/12/eslint-v6.8.0-released) | Includes rules and expects the **recommended** configuration from this version.<br/>**6.8.0** is the last version to support **Node.js 8 LTS**. | | ||
| [Node.js](https://nodejs.org/) | [^8.9.0](https://nodejs.org/en/download/releases/) | **Node.js 8 LTS** started at version **8.9.0**. | | ||
| [V8](https://v8.dev/) | [6.1](https://v8.dev/blog/v8-release-61) <br/> [6.2](https://v8.dev/blog/v8-release-62) | **Node.js 8 LTS** started with **V8 6.1** and updated to **V8 6.2** at version **8.10.0**. | | ||
|
||
# Files | ||
| File | Description | | ||
|------|-------------| | ||
| `.eslintrc.js` | The root file which includes other modular files. | | ||
| `.eslintrc-base.js` | Includes all rules that don't relate to ES6+ language features. | | ||
| `.eslintrc-es6plus.js` | Includes all rules that relate to ES6+ language features. | | ||
| `test/.eslintrc.js` | Rules for test files, including Jest-specific rules. | |
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,33 @@ | ||
module.exports = { | ||
extends: [ | ||
'plugin:jest/recommended', | ||
'plugin:jest/style' | ||
], | ||
env: { | ||
jest: true, | ||
}, | ||
rules: { | ||
'max-lines-per-function': 0, // Unit tests get big sometimes. | ||
'padded-blocks': 0, // Allow some extra air inside of describe blocks. | ||
|
||
// eslint-plugin-jest | ||
'jest/consistent-test-it': [2, { fn: 'it', withinDescribe: 'it' }], | ||
'jest/lowercase-name': [2, { ignore: ['describe'] }], | ||
'jest/no-deprecated-functions': 2, | ||
'jest/no-duplicate-hooks': 2, | ||
'jest/no-if': 2, | ||
'jest/no-large-snapshots': 2, | ||
'jest/no-restricted-matchers': [2, { | ||
toBeTruthy: 'Avoid `toBeTruthy`', | ||
toBeFalsy: 'Avoid `toBeFalsy`', | ||
}], | ||
'jest/no-test-return-statement': 2, | ||
'jest/prefer-called-with': 2, | ||
'jest/prefer-hooks-on-top': 2, | ||
'jest/prefer-spy-on': 2, | ||
'jest/prefer-strict-equal': 2, | ||
'jest/prefer-todo': 2, | ||
'jest/require-to-throw-message': 2, | ||
'jest/valid-title': 2, | ||
} | ||
}; |