Skip to content

Commit fa28056

Browse files
committed
Use @kevinoid/eslint-config
Move my ESLint configuration out of this template and into its own package (with support for additional environments and plugins) for easier maintenance and use across environments/packages. Signed-off-by: Kevin Locke <[email protected]>
1 parent fb5f212 commit fa28056

File tree

3 files changed

+368
-131
lines changed

3 files changed

+368
-131
lines changed

.eslintrc.json

Lines changed: 1 addition & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,8 @@
11
// ESLint configuration <https://eslint.org/docs/user-guide/configuring>
22
{
3-
// Based on Airbnb with changes to match Node core and my prefs.
4-
"extends": "airbnb-base",
5-
6-
"parserOptions": {
7-
"sourceType": "script"
8-
},
3+
"extends": "@kevinoid/eslint-config/node.js",
94

105
"rules": {
11-
//// Best Practices <https://eslint.org/docs/rules/#best-practices>
12-
// require curly braces around all control statements, not just multi-line.
13-
"curly": ["error", "all"],
14-
// disallow unnecessary parentheses
15-
"no-extra-parens": ["error", "all", {
16-
"conditionalAssign": false,
17-
"enforceForArrowConditionals": false,
18-
"nestedBinaryExpressions": false,
19-
"returnAssign": false
20-
}],
21-
// allow multiple spaces only before EOL (for inline comment alignment)
22-
"no-multi-spaces": ["error", { "ignoreEOLComments": true }],
23-
// allow reassignment of function parameters
24-
// simplicity for optional arguments outweighs the perf advantage, usually
25-
"no-param-reassign": "off",
26-
// disallow unnecessary use of Function.prototype.{apply,call}
27-
"no-useless-call": "error",
28-
29-
//// Strict Mode <https://eslint.org/docs/rules/#strict-mode>
30-
// require 'use strict' in global scope
31-
"strict": ["error", "global"],
32-
33-
//// Variables <https://eslint.org/docs/rules/#variables>
34-
// disallow shadowing of variables (including builtins and hoisted funcs)
35-
"no-shadow": ["error", { "builtinGlobals": true, "hoist": "all" }],
36-
// disallow declaration of variables that are not used in the code
37-
// allow unused args for documentation, future use, and correct .length
38-
"no-unused-vars": ["error", {"args": "none"}],
39-
40-
//// Stylistic Issues <https://eslint.org/docs/rules/#stylistic-issues>
41-
// require camel case names (even for properties and destructuring)
42-
// Note: options object needed to override airbnb, values set for clarity.
43-
"camelcase": ["error", {
44-
"ignoreDestructuring": false,
45-
"properties": "always"
46-
}],
47-
// allow unnamed functions
48-
"func-names": "off",
49-
// don't enforce consistent linebreak style
50-
// Allow developers to develop with native EOL. VCS manages committed style.
51-
"linebreak-style": "off",
52-
// enforce a maximum line length
53-
// reduce from 100 to 80 chars (conventional terminal width)
54-
// ignore lines which consist of a single string, URL, or RegExp literal,
55-
// possibly prefixed with comment opener or suffixed with ";".
56-
// (Not ESLint ignore props which ignores any lines which contain these.)
57-
"max-len": ["error", 80, 2, {
58-
"ignorePattern": "^\\s*((/?\\*|/[/])\\s*)?('[^'\\\\]*(\\\\.[^'\\\\]*)*'|\"[^\"\\\\]*(\\\\.[^\"\\\\]*)*\"|/[^/\\\\]*(\\\\.[^/\\\\]*)*/[gimuy]*|[^:/?#\\s]+:/[/]\\S+);?$"
59-
}],
60-
// allow nested ternary expressions
61-
// if they are indented one-expression-per-line, they are clear enough for me
62-
"no-nested-ternary": "off",
63-
// disallow process.exit()
64-
// this is disabled locally only when require.main === module
65-
"no-process-exit": "error",
66-
// disallow extra spaces in object literals
67-
"object-curly-spacing": ["error", "never"],
68-
// allow multiple variable declarations per block/function and multiple
69-
// declarators per declaration
70-
"one-var": "off",
71-
// require initialized variables to be declared on separate lines
72-
"one-var-declaration-per-line": ["error", "initializations"],
73-
// Requires operator at the beginning of the line in multiline statements
74-
// Airbnb prevents breaks around =, suggesting (). I don't see the advantage.
75-
// Break after = looks better to me, so first assigned operand is farther left.
76-
"operator-linebreak": ["error", "before", { "overrides": { "=": "after" } }],
77-
// space before function parens only for async arrow (as Node core does)
78-
"space-before-function-paren": ["error", {
79-
"anonymous": "never",
80-
"named": "never",
81-
"asyncArrow": "always"
82-
}],
83-
84-
//// ECMAScript 6 Rules <https://eslint.org/docs/rules/#ecmascript-6>
85-
// eslint-plugin-import
866
// Allow requiring devDependencies for build and test
877
"import/no-extraneous-dependencies": ["error", {
888
"devDependencies": [

0 commit comments

Comments
 (0)