Skip to content
This repository was archived by the owner on Jun 20, 2019. It is now read-only.

Commit b2688d6

Browse files
authored
fix: Use eslint-plugin-wordpress/jscs shared configuration. (#22)
This change allows `eslint-config-wordpress` to be used as a "drop in" replacement for JSCS WordPress preset.
1 parent 25114c9 commit b2688d6

File tree

1 file changed

+67
-18
lines changed

1 file changed

+67
-18
lines changed

index.js

Lines changed: 67 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
module.exports = {
2-
32
env: {
43
browser: true
54
},
@@ -20,30 +19,80 @@ module.exports = {
2019
'no-irregular-whitespace': 'error',
2120
// Best Practices
2221
// Specify curly brace conventions for all control statements
23-
'curly': 'error',
24-
// Require the use of === and !==
25-
'eqeqeq': 'error',
26-
// Disallow use of arguments.caller or arguments.callee
27-
'no-caller': 'error',
28-
// Disallow comparisons to null without a type-checking operator
29-
'no-eq-null': 'error',
30-
// Disallow usage of expressions in statement position
31-
'no-unused-expressions': 'error',
22+
'curly': ['error', 'all'],
23+
// Encourages use of dot notation whenever possible
24+
'dot-notation': ['error', {
25+
allowKeywords: true,
26+
allowPattern: '^[a-z]+(_[a-z]+)+$'
27+
}],
28+
// Disallow use of multiline strings
29+
'no-multi-str': 'error',
30+
// Disallow use of the with statement
31+
'no-with': 'error',
32+
// Requires to declare all vars on top of their containing scope
33+
'vars-on-top': 'error',
3234
// Require immediate function invocation to be wrapped in parentheses
33-
'wrap-iife': ['error', 'any'],
35+
'wrap-iife': 'error',
36+
// Require or disallow Yoda conditions
37+
'yoda': ['error', 'always'],
3438
// Strict Mode
3539
// Variables
36-
// Disallow use of undeclared variables unless mentioned in a /*global */ block
37-
'no-undef': 'error',
38-
// Disallow declaration of variables that are not used in the code
39-
'no-unused-vars': 'error',
4040
// Stylistic Issues
41+
// Enforce spacing inside array brackets
42+
'array-bracket-spacing': ['error', 'always'],
43+
// Enforce one true brace style
44+
'brace-style': 'error',
45+
// Require camel case names
46+
'camelcase': ['error', {
47+
properties: 'always'
48+
}],
49+
// Disallow or enforce trailing commas
50+
'comma-dangle': ['error', 'never'],
51+
// Enforce spacing before and after comma
52+
'comma-spacing': 'error',
53+
// Enforce one true comma style
54+
'comma-style': ['error', 'last'],
55+
// Enforce newline at the end of file, with no multiple empty lines
56+
'eol-last': 'error',
57+
// Enforces spacing between keys and values in object literal properties
58+
'key-spacing': ['error', {
59+
beforeColon: false,
60+
afterColon: true
61+
}],
62+
// Enforce spacing before and after keywords
63+
'keyword-spacing': 'error',
64+
// Disallow mixed "LF" and "CRLF" as linebreaks
65+
'linebreak-style': ['error', 'unix'],
66+
// Enforces empty lines around comments
67+
'lines-around-comment': ['error', {
68+
beforeLineComment: true
69+
}],
70+
// Disallow mixed spaces and tabs for indentation
71+
'no-mixed-spaces-and-tabs': 'error',
72+
// Disallow multiple empty lines
73+
'no-multiple-empty-lines': 'error',
4174
// Disallow trailing whitespace at the end of lines
4275
'no-trailing-spaces': 'error',
43-
// Enforce variables to be declared either together or separately in functions
44-
'one-var': ['error', 'always'],
76+
// Require or disallow an newline around variable declarations
77+
'one-var-declaration-per-line': ['error', 'initializations'],
78+
// Enforce operators to be placed before or after line breaks
79+
'operator-linebreak': ['error', 'after'],
4580
// Specify whether backticks, double or single quotes should be used
46-
'quotes': ['error', 'single']
81+
'quotes': ['error', 'single'],
82+
// Require or disallow use of semicolons instead of ASI
83+
'semi': ['error', 'always'],
84+
// Require or disallow space before blocks
85+
'space-before-blocks': ['error', 'always'],
86+
// Require or disallow space before function opening parenthesis
87+
'space-before-function-paren': ['error', 'never'],
88+
// Require or disallow space before blocks
89+
'space-in-parens': ['error', 'always', {exceptions: ['{}', '[]']}],
90+
// Require spaces around operators
91+
'space-infix-ops': 'error',
92+
// Require or disallow spaces before/after unary operators (words on by default, nonwords)
93+
'space-unary-ops': ['error', {
94+
overrides: {'!': true}
95+
}]
4796
// Legacy
4897
}
4998
};

0 commit comments

Comments
 (0)