Skip to content

Commit b9d730c

Browse files
committed
Add a shareable version of my ESLint configuration
1 parent e03c83f commit b9d730c

File tree

4 files changed

+232
-0
lines changed

4 files changed

+232
-0
lines changed

eslint/.eslintrc.json

Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
{
2+
"extends": "eslint:recommended",
3+
"env": {
4+
"browser": true,
5+
"es6": true,
6+
"mocha": true,
7+
"node": true
8+
},
9+
"parserOptions": {
10+
"ecmaVersion": 2018,
11+
"sourceType": "module"
12+
},
13+
"rules": {
14+
"arrow-body-style": [
15+
"error",
16+
"as-needed"
17+
],
18+
"arrow-parens": [
19+
"error",
20+
"as-needed"
21+
],
22+
"arrow-spacing": "error",
23+
"block-spacing": "error",
24+
"brace-style": [
25+
"error",
26+
"stroustrup",
27+
{"allowSingleLine": true}
28+
],
29+
"camelcase": "error",
30+
"capitalized-comments": [
31+
"error",
32+
"always",
33+
{
34+
"ignorePattern": "camelCased|camelCase",
35+
"ignoreInlineComments": true,
36+
"ignoreConsecutiveComments": true
37+
}
38+
],
39+
"comma-dangle": [
40+
"error",
41+
"always-multiline"
42+
],
43+
"comma-spacing": "error",
44+
"comma-style": [
45+
"error",
46+
"last"
47+
],
48+
"consistent-this": [
49+
"error",
50+
"THIS"
51+
],
52+
"eol-last": "error",
53+
"eqeqeq": [
54+
"error",
55+
"smart"
56+
],
57+
"eol-last": [
58+
"error",
59+
"always"
60+
],
61+
"func-style": [
62+
"error",
63+
"declaration",
64+
{"allowArrowFunctions": true}
65+
],
66+
"indent": [
67+
"error",
68+
"tab",
69+
{
70+
"ignoreComments": true,
71+
"VariableDeclarator": 0,
72+
"SwitchCase": 1
73+
}
74+
],
75+
"keyword-spacing": [
76+
"error",
77+
{
78+
"overrides": {
79+
"if": {"after": false},
80+
"else": {"after": false},
81+
"for": {"after": false},
82+
"while": {"after": false},
83+
"switch": {"after": false},
84+
"try": {"after": false},
85+
"catch": {"after": false},
86+
"finally": {"after": false},
87+
"with": {"after": false}
88+
}
89+
}
90+
],
91+
"linebreak-style": "error",
92+
"multiline-comment-style": [
93+
"error",
94+
"separate-lines"
95+
],
96+
"multiline-ternary": [
97+
"error",
98+
"always-multiline"
99+
],
100+
"new-parens": "error",
101+
"no-fallthrough": [
102+
"error",
103+
{"commentPattern": "[Ff]alls?[-\\s]?through"}
104+
],
105+
"no-duplicate-imports": [
106+
"error",
107+
{"includeExports": true}
108+
],
109+
"no-case-declarations": 0,
110+
"no-cond-assign": 0,
111+
"no-console": 0,
112+
"no-control-regex": 0,
113+
"no-empty": 0,
114+
"no-return-await": "error",
115+
"no-self-compare": "error",
116+
"no-sparse-arrays": 0,
117+
"no-trailing-spaces": [
118+
"error",
119+
{
120+
"skipBlankLines": true,
121+
"ignoreComments": true
122+
}
123+
],
124+
"no-undef-init": "error",
125+
"no-underscore-dangle": [
126+
"error",
127+
{"allowAfterThis": true}
128+
],
129+
"no-unneeded-ternary": "error",
130+
"no-useless-concat": "error",
131+
"no-useless-constructor": "error",
132+
"no-useless-rename": "error",
133+
"no-var": "error",
134+
"no-with": "error",
135+
"operator-linebreak": [
136+
"error",
137+
"before"
138+
],
139+
"prefer-arrow-callback": "error",
140+
"prefer-const": [
141+
"error",
142+
{"destructuring": "all"}
143+
],
144+
"prefer-destructuring": [
145+
"error",
146+
{"array": false, "object": true},
147+
{"enforceForRenamedProperties": false}
148+
],
149+
"prefer-numeric-literals": "error",
150+
"prefer-object-spread": "error",
151+
"prefer-rest-params": "error",
152+
"prefer-spread": "error",
153+
"prefer-template": "error",
154+
"quotes": [
155+
"error",
156+
"double",
157+
{"avoidEscape": true}
158+
],
159+
"quote-props": [
160+
"error",
161+
"as-needed"
162+
],
163+
"semi": [
164+
"error",
165+
"always"
166+
],
167+
"semi-spacing": "error",
168+
"semi-style": [
169+
"error",
170+
"last"
171+
],
172+
"spaced-comment": [
173+
"error",
174+
"always"
175+
],
176+
"space-before-function-paren": [
177+
"error",
178+
"never"
179+
],
180+
"space-in-parens": [
181+
"error",
182+
"never"
183+
],
184+
"switch-colon-spacing": "error",
185+
"space-unary-ops": [
186+
"error",
187+
{
188+
"words": true,
189+
"nonwords": false
190+
}
191+
],
192+
"unicode-bom": "error",
193+
"vars-on-top": "error",
194+
"yoda": [
195+
"error",
196+
"always",
197+
{"onlyEquality": true}
198+
]
199+
}
200+
}

eslint/atom.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Variant of default config optimised for Atom projects
2+
"use strict";
3+
4+
module.exports = {...require("./.eslintrc.json")};
5+
6+
if(!module.exports.env) module.exports.env = {};
7+
if(!module.exports.globals) module.exports.globals = {};
8+
9+
module.exports.env.atomtest = true;
10+
Object.assign(module.exports.globals, {
11+
atom: true,
12+
attachToDOM: true,
13+
Chai: true,
14+
expect: true,
15+
when: true,
16+
unlessOnWindows: true,
17+
});

eslint/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"use strict";
2+
3+
module.exports = require("./.eslintrc.json");

eslint/package.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"name": "@alhadis/eslint-config",
3+
"version": "v1.0.0",
4+
"description": "Shareable version of my ESLint config.",
5+
"readme": "[Go here](https://github.com/Alhadis/Coding-Style) for an entertaining overview of my coding preferences.",
6+
"repository": "https://github.com/Alhadis/Coding-Style/tree/master/eslint",
7+
"license": "ISC",
8+
"keywords": ["eslint", "eslintconfig"],
9+
"scripts": {"test": "eslint ."},
10+
"peerDependencies": {"eslint": ">=v5.6.0"},
11+
"publishConfig": {"access": "public"}
12+
}

0 commit comments

Comments
 (0)