Skip to content

Commit b193a97

Browse files
committed
Update ESLint to latest version and use new ESLint config
1 parent 1b9fab4 commit b193a97

File tree

5 files changed

+174
-157
lines changed

5 files changed

+174
-157
lines changed

.eslintrc

Lines changed: 0 additions & 129 deletions
This file was deleted.

.eslintrc.json

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
{
2+
"env": {
3+
"node": true,
4+
"es6": true
5+
},
6+
"parserOptions": {
7+
"ecmaVersion": 6,
8+
"sourceType": "module"
9+
},
10+
"rules": {
11+
// Possible Errors
12+
"no-cond-assign": ["error"],
13+
"no-console": ["error"],
14+
"no-constant-condition": ["error"],
15+
"no-control-regex": ["error"],
16+
"no-debugger": ["error"],
17+
"no-dupe-args": ["error"],
18+
"no-dupe-keys": ["error"],
19+
"no-duplicate-case": ["error"],
20+
"no-empty": ["error"],
21+
"no-empty-character-class": ["error"],
22+
"no-ex-assign": ["error"],
23+
"no-extra-boolean-cast": ["error"],
24+
"no-extra-semi": ["error"],
25+
"no-func-assign": ["error"],
26+
"no-inner-declarations": ["error"],
27+
"no-invalid-regexp": ["error"],
28+
"no-irregular-whitespace": ["error"],
29+
"no-negated-in-lhs": ["error"],
30+
"no-obj-calls": ["error"],
31+
"no-regex-spaces": ["error"],
32+
"no-sparse-arrays": ["error"],
33+
"no-unexpected-multiline": ["error"],
34+
"no-unreachable": ["error"],
35+
"use-isnan": ["error"],
36+
"valid-typeof": ["error"],
37+
38+
// Best Practices
39+
"curly": ["error"],
40+
"default-case": ["error"],
41+
"dot-location": ["error", "property"],
42+
"dot-notation": ["error"],
43+
"eqeqeq": ["error", "allow-null"],
44+
"no-alert": ["error"],
45+
"no-case-declarations": ["error"],
46+
"no-div-regex": ["error"],
47+
"no-else-return": ["error"],
48+
"no-empty-function": ["error"],
49+
"no-empty-pattern": ["error"],
50+
"no-eq-null": ["error"],
51+
"no-eval": ["error"],
52+
"no-extend-native": ["error"],
53+
"no-extra-label": ["error"],
54+
"no-fallthrough": ["error"],
55+
"no-floating-decimal": ["error"],
56+
"no-implicit-coercion": ["error"],
57+
"no-implied-eval": ["error"],
58+
"no-iterator": ["error"],
59+
"no-labels": ["error"],
60+
"no-lone-blocks": ["error"],
61+
"no-loop-func": ["error"],
62+
"no-multi-spaces": ["error"],
63+
"no-native-reassign": ["error"],
64+
"no-new": ["error"],
65+
"no-new-func": ["error"],
66+
"no-new-wrappers": ["error"],
67+
"no-octal": ["error"],
68+
"no-octal-escape": ["error"],
69+
"no-proto": ["error"],
70+
"no-redeclare": ["error"],
71+
"no-return-assign": ["error"],
72+
"no-script-url": ["error"],
73+
"no-self-assign": ["error"],
74+
"no-self-compare": ["error"],
75+
"no-sequences": ["error"],
76+
"no-throw-literal": ["error"],
77+
"no-unmodified-loop-condition": ["error"],
78+
"no-unused-expressions": ["error"],
79+
"no-unused-labels": ["error"],
80+
"no-useless-call": ["error"],
81+
"no-useless-concat": ["error"],
82+
"no-useless-escape": ["error"],
83+
"no-void": ["error"],
84+
"no-warning-comments": ["error"],
85+
"no-with": ["error"],
86+
"radix": ["error"],
87+
"wrap-iife": ["error", "any"],
88+
"yoda": ["error"],
89+
90+
// Variables
91+
"no-catch-shadow": ["error"],
92+
"no-delete-var": ["error"],
93+
"no-label-var": ["error"],
94+
"no-restricted-globals": ["error"],
95+
"no-shadow": ["error"],
96+
"no-shadow-restricted-names": ["error"],
97+
"no-undef": ["error"],
98+
"no-undef-init": ["error"],
99+
"no-undefined": ["error"],
100+
"no-unused-vars": ["error"],
101+
102+
// Stylistic Issues
103+
"array-bracket-spacing": ["error", "never"],
104+
"block-spacing": ["error", "always"],
105+
"brace-style": ["error"],
106+
"camelcase": ["error"],
107+
"comma-spacing": ["error"],
108+
"comma-style": ["error"],
109+
"computed-property-spacing": ["error"],
110+
"eol-last": ["error"],
111+
"indent": ["error", "tab"],
112+
"key-spacing": ["error"],
113+
"keyword-spacing": ["error"],
114+
"linebreak-style": ["error"],
115+
"newline-after-var": ["error"],
116+
"newline-before-return": ["error"],
117+
"no-bitwise": ["error"],
118+
"no-lonely-if": ["error"],
119+
"no-mixed-spaces-and-tabs": ["error", "smart-tabs"],
120+
"no-multiple-empty-lines": ["error", {"max": 1, "maxEOF": 1, "maxBOF": 0}],
121+
"no-nested-ternary": ["error"],
122+
"no-new-object": ["error"],
123+
"no-spaced-func": ["error"],
124+
"no-trailing-spaces": ["error"],
125+
"no-unneeded-ternary": ["error"],
126+
"no-whitespace-before-property": ["error"],
127+
"object-curly-spacing": ["error", "always"],
128+
"one-var": ["error", "never"],
129+
"one-var-declaration-per-line": ["error"],
130+
"padded-blocks": ["error", "never"],
131+
"quote-props": ["error", "as-needed"],
132+
"quotes": ["error", "single"],
133+
"semi": ["error", "always"],
134+
"semi-spacing": ["error"],
135+
"space-before-blocks": ["error"],
136+
"space-before-function-paren": ["error", {"anonymous": "always", "named": "never"}],
137+
"space-in-parens": ["error"],
138+
"space-infix-ops": ["error"],
139+
"space-unary-ops": ["error"],
140+
"spaced-comment": ["error"],
141+
"wrap-regex": ["error"]
142+
}
143+
}

index.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ function getAtruleSortName(node, order) {
7575
var atruleName = '@' + node.name;
7676

7777
// If atRule has a parameter like @mixin name or @include name, sort by this parameter
78-
var atruleParameter = /^[\w-]+/.exec(node.params);
78+
var atruleParameter = (/^[\w-]+/).exec(node.params);
7979

8080
if (atruleParameter && atruleParameter.length) {
8181
var sortNameExtended = atruleName + ' ' + atruleParameter[0];
@@ -96,7 +96,7 @@ function getAtruleSortName(node, order) {
9696
function getSortName(node, order) {
9797
switch (node.type) {
9898
case 'decl':
99-
return /^\$[\w-]+/.test(node.prop) ? '$variable' : node.prop;
99+
return (/^\$[\w-]+/).test(node.prop) ? '$variable' : node.prop;
100100

101101
case 'atrule':
102102
return getAtruleSortName(node, order);
@@ -206,7 +206,6 @@ module.exports = postcss.plugin('postcss-sorting', function (opts) {
206206
css.walk(function (rule) {
207207
// Process only rules and atrules with nodes
208208
if ((rule.type === 'rule' || rule.type === 'atrule') && rule.nodes && rule.nodes.length) {
209-
210209
// Nodes for sorting
211210
var processed = [];
212211

@@ -243,12 +242,16 @@ module.exports = postcss.plugin('postcss-sorting', function (opts) {
243242
processed.sort(function (a, b) {
244243
// If a's group index is higher than b's group index, in a sorted
245244
// list a appears after b:
246-
if (a.groupIndex !== b.groupIndex) return a.groupIndex - b.groupIndex;
245+
if (a.groupIndex !== b.groupIndex) {
246+
return a.groupIndex - b.groupIndex;
247+
}
247248

248249
// If a and b have the same group index, and a's property index is
249250
// higher than b's property index, in a sorted list a appears after
250251
// b:
251-
if (a.propertyIndex !== b.propertyIndex) return a.propertyIndex - b.propertyIndex;
252+
if (a.propertyIndex !== b.propertyIndex) {
253+
return a.propertyIndex - b.propertyIndex;
254+
}
252255

253256
// If a and b have the same group index and the same property index,
254257
// in a sorted list they appear in the same order they were in

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
},
2626
"devDependencies": {
2727
"ava": "^0.13.0",
28-
"eslint": "^1.10.2",
28+
"eslint": "^2.8.0",
2929
"postcss-less": "^0.8.0",
3030
"postcss-scss": "^0.1.7"
3131
},

0 commit comments

Comments
 (0)