Skip to content

Commit 37fdcee

Browse files
committed
Switched to new flat eslint config
1 parent 5cd6419 commit 37fdcee

File tree

6 files changed

+282
-76
lines changed

6 files changed

+282
-76
lines changed

.eslintrc renamed to .eslintrc (do not use)

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// OLD FILE FOR REFERENCE ONLY!!!
2+
// USE eslint.config.js INSTEAD!!!
3+
14
{ // NullDev-Style ESLint Config: https://github.com/NullDev/JavaScript-Styleguide
25
"plugins": [], // Additional ESLint Plugins
36
"env": { // http://eslint.org/docs/user-guide/configuring.html#specifying-environments
@@ -197,4 +200,4 @@
197200
"space-return-throw-case": 0, // http://eslint.org/docs/rules/space-return-throw-case
198201
"spaced-comment": 2 // http://eslint.org/docs/rules/spaced-comment
199202
}
200-
}
203+
}

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
<p align="center"><b>A <i>mostly</i> reasonable approach to JavaScript</b></p>
77
<p align="center"><sub>Or... Mainly NodeJS...</sub></p>
88

9+
## Now with the new ESLint Flat Config!
10+
911
</p>
1012

1113
---
@@ -19,7 +21,7 @@
1921
- Install [Babel-ESLint](https://www.npmjs.com/package/@babel/eslint-parser)*: <br>
2022
$ `npm install @babel/eslint-parser @babel/core eslint --save-dev`
2123
- Get the config: <br>
22-
$ `wget https://raw.githubusercontent.com/NullDev/JavaScript-Styleguide/master/.eslintrc`
24+
$ `wget https://raw.githubusercontent.com/NullDev/JavaScript-Styleguide/master/eslint.config.js`
2325
- Done! :)
2426

2527
<sub>*) The rationale for using Babel-ESLint is that it supports the newest Stage-3 ECMAScript features.</sub>
Lines changed: 69 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,61 @@
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+
},
926
},
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: {
2528
/**
2629
* Strict mode
2730
*/
28-
"strict": [2, "global"], // http://eslint.org/docs/rules/strict
31+
strict: [2, "global"], // http://eslint.org/docs/rules/strict
2932
/**
3033
* ES6
3134
*/
3235
"no-var": 2, // http://eslint.org/docs/rules/no-var
3336
"prefer-const": 2, // http://eslint.org/docs/rules/prefer-const
3437
"prefer-destructuring": [2, { // http://eslint.org/docs/rules/prefer-destructuring
35-
"array": false,
36-
"object": true
38+
array: false,
39+
object: true,
3740
}, {
38-
"enforceForRenamedProperties": false
41+
enforceForRenamedProperties: false,
3942
}],
4043
/**
4144
* Variables
4245
*/
4346
"no-shadow": 2, // http://eslint.org/docs/rules/no-shadow
4447
"no-shadow-restricted-names": 2, // http://eslint.org/docs/rules/no-shadow-restricted-names
4548
"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",
4851
}],
4952
"no-use-before-define": 2, // http://eslint.org/docs/rules/no-use-before-define
5053
/**
5154
* Possible errors
5255
*/
5356
"comma-dangle": [ // http://eslint.org/docs/rules/comma-dangle
5457
2,
55-
"always-multiline"
58+
"always-multiline",
5659
],
5760
"no-cond-assign": [2, "always"], // http://eslint.org/docs/rules/no-cond-assign
5861
"no-console": 0, // http://eslint.org/docs/rules/no-console
@@ -80,16 +83,16 @@
8083
* Best practices
8184
*/
8285
"array-callback-return": [2, { // http://eslint.org/docs/rules/array-callback-return
83-
"allowImplicit": true
86+
allowImplicit: true,
8487
}],
8588
"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
8790
"default-case": 2, // http://eslint.org/docs/rules/default-case
8891
"dot-notation": [2, { // http://eslint.org/docs/rules/dot-notation
89-
"allowKeywords": true
92+
allowKeywords: true,
9093
}],
9194
"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
9396
"guard-for-in": 0, // http://eslint.org/docs/rules/guard-for-in
9497
"no-array-constructor": 2, // http://eslint.org/docs/rules/no-array-constructor
9598
"no-caller": 2, // http://eslint.org/docs/rules/no-caller
@@ -120,81 +123,81 @@
120123
"no-sequences": 2, // http://eslint.org/docs/rules/no-sequences
121124
"no-throw-literal": 2, // http://eslint.org/docs/rules/no-throw-literal
122125
"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
124127
"vars-on-top": 2, // http://eslint.org/docs/rules/vars-on-top
125128
"wrap-iife": [2, "any"], // http://eslint.org/docs/rules/wrap-iife
126129
"object-shorthand": [2, "always", { // http://eslint.org/docs/rules/object-shorthand
127-
"ignoreConstructors": true,
128-
"avoidQuotes": true
130+
ignoreConstructors: true,
131+
avoidQuotes: true,
129132
}],
130133
"quote-props": [2, "as-needed", { // http://eslint.org/docs/rules/quote-props
131-
"keywords": true
134+
keywords: true,
132135
}],
133-
"yoda": 2, // http://eslint.org/docs/rules/yoda
136+
yoda: 2, // http://eslint.org/docs/rules/yoda
134137
/**
135138
* Style
136139
*/
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,
139142
}],
140143
"brace-style": [2, // http://eslint.org/docs/rules/brace-style
141144
"stroustrup", {
142-
"allowSingleLine": true
143-
}
145+
allowSingleLine: true,
146+
},
144147
],
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
147150
],
148-
"camelcase": [2, { // http://eslint.org/docs/rules/camelcase
149-
"properties": "never"
151+
camelcase: [2, { // http://eslint.org/docs/rules/camelcase
152+
properties: "never",
150153
}],
151154
"comma-spacing": [2, { // http://eslint.org/docs/rules/comma-spacing
152-
"before": false,
153-
"after": true
155+
before: false,
156+
after: true,
154157
}],
155158
"comma-style": [2, "last"], // http://eslint.org/docs/rules/comma-style
156159
"eol-last": 2, // http://eslint.org/docs/rules/eol-last
157160
"func-names": 0, // http://eslint.org/docs/rules/func-names
158161
"key-spacing": [2, { // http://eslint.org/docs/rules/key-spacing
159-
"beforeColon": false,
160-
"afterColon": true
162+
beforeColon: false,
163+
afterColon: true,
161164
}],
162165
"new-cap": [2, { // http://eslint.org/docs/rules/new-cap
163-
"newIsCap": true
166+
newIsCap: true,
164167
}],
165168
"no-multiple-empty-lines": [2, { // http://eslint.org/docs/rules/no-multiple-empty-lines
166-
"max": 2
169+
max: 2,
167170
}],
168171
"no-nested-ternary": 2, // http://eslint.org/docs/rules/no-nested-ternary
169172
"no-new-object": 2, // http://eslint.org/docs/rules/no-new-object
170173
"no-spaced-func": 2, // http://eslint.org/docs/rules/no-spaced-func
171174
"no-trailing-spaces": 2, // http://eslint.org/docs/rules/no-trailing-spaces
172175
"no-extra-parens": [2,
173-
"functions" // http://eslint.org/docs/rules/no-extra-parens
176+
"functions", // http://eslint.org/docs/rules/no-extra-parens
174177
],
175178
"no-underscore-dangle": 0, // http://eslint.org/docs/rules/no-underscore-dangle
176179
"one-var": [2, "never"], // http://eslint.org/docs/rules/one-var
177180
"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
179182
"semi-spacing": [2, { // http://eslint.org/docs/rules/semi-spacing
180-
"before": false,
181-
"after": true
183+
before: false,
184+
after: true,
182185
}],
183186
"space-after-keywords": 0, // http://eslint.org/docs/rules/space-after-keywords
184187
"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",
188191
}],
189192
"keyword-spacing": [0, { // http://eslint.org/docs/rules/keyword-spacing
190-
"before": false,
191-
"after": true
193+
before: false,
194+
after: true,
192195
}],
193196
"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
195198
],
196199
"space-infix-ops": 2, // http://eslint.org/docs/rules/space-infix-ops
197200
"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

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy