|
1 |
| -{ // NullDev-Style ESLint Config: https://github.com/NullDev/JavaScript-Styleguide |
2 |
| - "plugins": [], // Additional ESLint Plugins |
3 |
| - "env": { // http://eslint.org/docs/user-guide/configuring.html#specifying-environments |
4 |
| - "browser": true, // browser global variables |
5 |
| - "node": true, // Node.js global variables and Node.js-specific rules |
6 |
| - "commonjs": true, // CommonJS global variables and CommonJS scoping |
7 |
| - "es2022": true, // ESNext support |
8 |
| - "es6": true // enable all ECMAScript 6 features |
| 1 | +// @ts-ignore |
| 2 | +import babelParser from "@babel/eslint-parser"; |
| 3 | + |
| 4 | +export default [{ // NullDev-Style ESLint Config: https://github.com/NullDevCo/JavaScript-Styleguide |
| 5 | + ignores: ["dist", "node_modules"], // Ignore dist folders and dependencies |
| 6 | + files: ["**/*.js", "**/*.jsx"], |
| 7 | + plugins: {}, // Additional ESLint Plugins |
| 8 | + languageOptions: { |
| 9 | + parser: babelParser, // npm install @babel/eslint-parser @babel/core eslint --save-dev |
| 10 | + ecmaVersion: "latest", // set highest possible version |
| 11 | + sourceType: "module", // prefer ES Modules (doesn't require "use strict") |
| 12 | + parserOptions: { |
| 13 | + requireConfigFile: false, // make babel not look for config |
| 14 | + babelOptions: { |
| 15 | + plugins: [ // additional plugins for new ES-proposals such as "@babel/plugin-proposal-class-properties" |
| 16 | + ], |
| 17 | + }, |
| 18 | + }, |
| 19 | + globals: { // http://eslint.org/docs/user-guide/configuring.html#specifying-environments |
| 20 | + browser: true, // browser global variables |
| 21 | + node: true, // Node.js global variables and Node.js-specific rules |
| 22 | + commonjs: true, // CommonJS global variables and CommonJS scoping |
| 23 | + es2022: true, // ESNext support |
| 24 | + es6: true, // enable all ECMAScript 6 features except for modules |
| 25 | + }, |
9 | 26 | },
|
10 |
| - "parser": "@babel/eslint-parser", // npm install @babel/eslint-parser @babel/core eslint --save-dev |
11 |
| - "parserOptions": { |
12 |
| - "ecmaVersion": "latest", // set highest possible version |
13 |
| - "sourceType": "module", // prefer ES Modules (doesn't require "use strict") |
14 |
| - "requireConfigFile": false, // make babel not look for config |
15 |
| - "babelOptions": { |
16 |
| - "plugins": [ // additional plugins for new ES-proposals such as "@babel/plugin-proposal-class-properties" |
17 |
| - ] |
18 |
| - } |
19 |
| - }, |
20 |
| - "ignorePatterns": [ // Ignore dist folders and dependencies |
21 |
| - "dist", |
22 |
| - "node_modules" |
23 |
| - ], |
24 |
| - "rules": { |
| 27 | + rules: { |
25 | 28 | /**
|
26 | 29 | * Strict mode
|
27 | 30 | */
|
28 |
| - "strict": [2, "global"], // http://eslint.org/docs/rules/strict |
| 31 | + strict: [2, "global"], // http://eslint.org/docs/rules/strict |
29 | 32 | /**
|
30 | 33 | * ES6
|
31 | 34 | */
|
32 | 35 | "no-var": 2, // http://eslint.org/docs/rules/no-var
|
33 | 36 | "prefer-const": 2, // http://eslint.org/docs/rules/prefer-const
|
34 | 37 | "prefer-destructuring": [2, { // http://eslint.org/docs/rules/prefer-destructuring
|
35 |
| - "array": false, |
36 |
| - "object": true |
| 38 | + array: false, |
| 39 | + object: true, |
37 | 40 | }, {
|
38 |
| - "enforceForRenamedProperties": false |
| 41 | + enforceForRenamedProperties: false, |
39 | 42 | }],
|
40 | 43 | /**
|
41 | 44 | * Variables
|
42 | 45 | */
|
43 | 46 | "no-shadow": 2, // http://eslint.org/docs/rules/no-shadow
|
44 | 47 | "no-shadow-restricted-names": 2, // http://eslint.org/docs/rules/no-shadow-restricted-names
|
45 | 48 | "no-unused-vars": [2, { // http://eslint.org/docs/rules/no-unused-vars
|
46 |
| - "vars": "local", |
47 |
| - "args": "after-used" |
| 49 | + vars: "local", |
| 50 | + args: "after-used", |
48 | 51 | }],
|
49 | 52 | "no-use-before-define": 2, // http://eslint.org/docs/rules/no-use-before-define
|
50 | 53 | /**
|
51 | 54 | * Possible errors
|
52 | 55 | */
|
53 | 56 | "comma-dangle": [ // http://eslint.org/docs/rules/comma-dangle
|
54 | 57 | 2,
|
55 |
| - "always-multiline" |
| 58 | + "always-multiline", |
56 | 59 | ],
|
57 | 60 | "no-cond-assign": [2, "always"], // http://eslint.org/docs/rules/no-cond-assign
|
58 | 61 | "no-console": 0, // http://eslint.org/docs/rules/no-console
|
|
80 | 83 | * Best practices
|
81 | 84 | */
|
82 | 85 | "array-callback-return": [2, { // http://eslint.org/docs/rules/array-callback-return
|
83 |
| - "allowImplicit": true |
| 86 | + allowImplicit: true, |
84 | 87 | }],
|
85 | 88 | "consistent-return": 1, // http://eslint.org/docs/rules/consistent-return
|
86 |
| - "curly": [2, "multi-line"], // http://eslint.org/docs/rules/curly |
| 89 | + curly: [2, "multi-line"], // http://eslint.org/docs/rules/curly |
87 | 90 | "default-case": 2, // http://eslint.org/docs/rules/default-case
|
88 | 91 | "dot-notation": [2, { // http://eslint.org/docs/rules/dot-notation
|
89 |
| - "allowKeywords": true |
| 92 | + allowKeywords: true, |
90 | 93 | }],
|
91 | 94 | "linebreak-style": [2, "unix"], // http://eslint.org/docs/rules/linebreak-style
|
92 |
| - "eqeqeq": 2, // http://eslint.org/docs/rules/eqeqeq |
| 95 | + eqeqeq: 2, // http://eslint.org/docs/rules/eqeqeq |
93 | 96 | "guard-for-in": 0, // http://eslint.org/docs/rules/guard-for-in
|
94 | 97 | "no-array-constructor": 2, // http://eslint.org/docs/rules/no-array-constructor
|
95 | 98 | "no-caller": 2, // http://eslint.org/docs/rules/no-caller
|
|
120 | 123 | "no-sequences": 2, // http://eslint.org/docs/rules/no-sequences
|
121 | 124 | "no-throw-literal": 2, // http://eslint.org/docs/rules/no-throw-literal
|
122 | 125 | "no-with": 2, // http://eslint.org/docs/rules/no-with
|
123 |
| - "radix": 2, // http://eslint.org/docs/rules/radix |
| 126 | + radix: 2, // http://eslint.org/docs/rules/radix |
124 | 127 | "vars-on-top": 2, // http://eslint.org/docs/rules/vars-on-top
|
125 | 128 | "wrap-iife": [2, "any"], // http://eslint.org/docs/rules/wrap-iife
|
126 | 129 | "object-shorthand": [2, "always", { // http://eslint.org/docs/rules/object-shorthand
|
127 |
| - "ignoreConstructors": true, |
128 |
| - "avoidQuotes": true |
| 130 | + ignoreConstructors: true, |
| 131 | + avoidQuotes: true, |
129 | 132 | }],
|
130 | 133 | "quote-props": [2, "as-needed", { // http://eslint.org/docs/rules/quote-props
|
131 |
| - "keywords": true |
| 134 | + keywords: true, |
132 | 135 | }],
|
133 |
| - "yoda": 2, // http://eslint.org/docs/rules/yoda |
| 136 | + yoda: 2, // http://eslint.org/docs/rules/yoda |
134 | 137 | /**
|
135 | 138 | * Style
|
136 | 139 | */
|
137 |
| - "indent": [2, 4, { // http://eslint.org/docs/rules/indent |
138 |
| - "SwitchCase": 1 |
| 140 | + indent: [2, 4, { // http://eslint.org/docs/rules/indent |
| 141 | + SwitchCase: 1, |
139 | 142 | }],
|
140 | 143 | "brace-style": [2, // http://eslint.org/docs/rules/brace-style
|
141 | 144 | "stroustrup", {
|
142 |
| - "allowSingleLine": true |
143 |
| - } |
| 145 | + allowSingleLine: true, |
| 146 | + }, |
144 | 147 | ],
|
145 |
| - "quotes": [ |
146 |
| - 2, "double", "avoid-escape" // http://eslint.org/docs/rules/quotes |
| 148 | + quotes: [ |
| 149 | + 2, "double", "avoid-escape", // http://eslint.org/docs/rules/quotes |
147 | 150 | ],
|
148 |
| - "camelcase": [2, { // http://eslint.org/docs/rules/camelcase |
149 |
| - "properties": "never" |
| 151 | + camelcase: [2, { // http://eslint.org/docs/rules/camelcase |
| 152 | + properties: "never", |
150 | 153 | }],
|
151 | 154 | "comma-spacing": [2, { // http://eslint.org/docs/rules/comma-spacing
|
152 |
| - "before": false, |
153 |
| - "after": true |
| 155 | + before: false, |
| 156 | + after: true, |
154 | 157 | }],
|
155 | 158 | "comma-style": [2, "last"], // http://eslint.org/docs/rules/comma-style
|
156 | 159 | "eol-last": 2, // http://eslint.org/docs/rules/eol-last
|
157 | 160 | "func-names": 0, // http://eslint.org/docs/rules/func-names
|
158 | 161 | "key-spacing": [2, { // http://eslint.org/docs/rules/key-spacing
|
159 |
| - "beforeColon": false, |
160 |
| - "afterColon": true |
| 162 | + beforeColon: false, |
| 163 | + afterColon: true, |
161 | 164 | }],
|
162 | 165 | "new-cap": [2, { // http://eslint.org/docs/rules/new-cap
|
163 |
| - "newIsCap": true |
| 166 | + newIsCap: true, |
164 | 167 | }],
|
165 | 168 | "no-multiple-empty-lines": [2, { // http://eslint.org/docs/rules/no-multiple-empty-lines
|
166 |
| - "max": 2 |
| 169 | + max: 2, |
167 | 170 | }],
|
168 | 171 | "no-nested-ternary": 2, // http://eslint.org/docs/rules/no-nested-ternary
|
169 | 172 | "no-new-object": 2, // http://eslint.org/docs/rules/no-new-object
|
170 | 173 | "no-spaced-func": 2, // http://eslint.org/docs/rules/no-spaced-func
|
171 | 174 | "no-trailing-spaces": 2, // http://eslint.org/docs/rules/no-trailing-spaces
|
172 | 175 | "no-extra-parens": [2,
|
173 |
| - "functions" // http://eslint.org/docs/rules/no-extra-parens |
| 176 | + "functions", // http://eslint.org/docs/rules/no-extra-parens |
174 | 177 | ],
|
175 | 178 | "no-underscore-dangle": 0, // http://eslint.org/docs/rules/no-underscore-dangle
|
176 | 179 | "one-var": [2, "never"], // http://eslint.org/docs/rules/one-var
|
177 | 180 | "padded-blocks": [2, "never"], // http://eslint.org/docs/rules/padded-blocks
|
178 |
| - "semi": [2, "always"], // http://eslint.org/docs/rules/semi |
| 181 | + semi: [2, "always"], // http://eslint.org/docs/rules/semi |
179 | 182 | "semi-spacing": [2, { // http://eslint.org/docs/rules/semi-spacing
|
180 |
| - "before": false, |
181 |
| - "after": true |
| 183 | + before: false, |
| 184 | + after: true, |
182 | 185 | }],
|
183 | 186 | "space-after-keywords": 0, // http://eslint.org/docs/rules/space-after-keywords
|
184 | 187 | "space-before-blocks": [2, { // http://eslint.org/docs/rules/space-before-blocks
|
185 |
| - "functions": "never", |
186 |
| - "keywords": "never", |
187 |
| - "classes": "always" |
| 188 | + functions: "never", |
| 189 | + keywords: "never", |
| 190 | + classes: "always", |
188 | 191 | }],
|
189 | 192 | "keyword-spacing": [0, { // http://eslint.org/docs/rules/keyword-spacing
|
190 |
| - "before": false, |
191 |
| - "after": true |
| 193 | + before: false, |
| 194 | + after: true, |
192 | 195 | }],
|
193 | 196 | "space-before-function-paren": [2,
|
194 |
| - "never" // http://eslint.org/docs/rules/space-before-function-paren |
| 197 | + "never", // http://eslint.org/docs/rules/space-before-function-paren |
195 | 198 | ],
|
196 | 199 | "space-infix-ops": 2, // http://eslint.org/docs/rules/space-infix-ops
|
197 | 200 | "space-return-throw-case": 0, // http://eslint.org/docs/rules/space-return-throw-case
|
198 |
| - "spaced-comment": 2 // http://eslint.org/docs/rules/spaced-comment |
199 |
| - } |
200 |
| -} |
| 201 | + "spaced-comment": 2, // http://eslint.org/docs/rules/spaced-comment |
| 202 | + }, |
| 203 | +}]; |
0 commit comments