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

Commit 5e4faf3

Browse files
Use strings to denote severity in rules
1 parent a72dadd commit 5e4faf3

File tree

11 files changed

+264
-264
lines changed

11 files changed

+264
-264
lines changed

coding-styles/fixable.js

Lines changed: 60 additions & 60 deletions
Large diffs are not rendered by default.

coding-styles/react.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,51 +14,51 @@ module.exports = {
1414
rules: {
1515
// Validate closing bracket location in JSX
1616
// This rule checks all JSX multiline elements and verifies the location of the closing bracket.
17-
'react/jsx-closing-bracket-location': [1, 'line-aligned'],
17+
'react/jsx-closing-bracket-location': ['warn', 'line-aligned'],
1818

1919
// Disallow spaces inside of curly braces in JSX attributes
20-
'react/jsx-curly-spacing': [1, 'never', {
20+
'react/jsx-curly-spacing': ['warn', 'never', {
2121
allowMultiline: true,
2222
}],
2323

2424
// Enforce or disallow spaces around equal signs in JSX attributes
2525
// This rule will enforce consistency of spacing around equal signs in JSX attributes, by
2626
// requiring or one or more spaces before and after =.
27-
'react/jsx-equals-spacing': [1, 'never'],
27+
'react/jsx-equals-spacing': ['warn', 'never'],
2828

2929
// Configure the position of the first property
30-
'react/jsx-first-prop-new-line': [1, 'multiline'],
30+
'react/jsx-first-prop-new-line': ['warn', 'multiline'],
3131

3232
// Validate JSX indentation
33-
'react/jsx-indent': [1, 2],
33+
'react/jsx-indent': ['warn', 2],
3434

3535
// Validate props indentation in JSX
36-
'react/jsx-indent-props': [1, 2],
36+
'react/jsx-indent-props': ['warn', 2],
3737

3838
// Enforce PascalCase for user-defined JSX components
3939
// Enforces coding style that user-defined JSX components are defined and referenced in
4040
// PascalCase.
41-
'react/jsx-pascal-case': [1, {
41+
'react/jsx-pascal-case': ['warn', {
4242
allowAllCaps: true,
4343
ignore: [],
4444
}],
4545

4646
// Validate spacing before closing bracket in JSX
4747
// This rule checks if there is one or more spaces before the closing bracket of self-closing
4848
// JSX elements.
49-
'react/jsx-space-before-closing': [1, 'always'],
49+
'react/jsx-space-before-closing': ['warn', 'always'],
5050

5151
// Validate whitespace in and around the JSX opening and closing brackets
5252
// This rule checks the whitespace inside and surrounding the JSX syntactic elements.
53-
'react/jsx-tag-spacing': 1,
53+
'react/jsx-tag-spacing': 'warn',
5454

5555
// Prevent extra closing tags for components without children
56-
'react/self-closing-comp': 1,
56+
'react/self-closing-comp': 'warn',
5757

5858
// Enforce component methods order
5959
// When creating React components it is more convenient to always follow the same organisation
6060
// for methods order to helps you to easily find lifecyle methods, event handlers, etc.
61-
'react/sort-comp': [1, {
61+
'react/sort-comp': ['warn', {
6262
order: [
6363
'static-methods',
6464
'lifecycle',

coding-styles/recommended.js

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,37 +18,37 @@ module.exports = {
1818
// This rule enforces consistent use of trailing commas in object and array literals
1919
// Allow trailing commas for func parameters, array and object literals spread across
2020
// multiple lines
21-
'comma-dangle': [1, 'always-multiline'],
21+
'comma-dangle': ['warn', 'always-multiline'],
2222

2323
// Require Camelcase
2424
// This rule looks for any underscores (_) located within the source code. It ignores leading
2525
// and trailing underscores and only checks those in the middle of a variable name. If ESLint
2626
// decides that the variable is a constant (all uppercase), then no warning will be thrown.
27-
camelcase: [1, {
27+
camelcase: ['warn', {
2828
properties: 'always',
2929
}],
3030

3131
// Require Consistent This
3232
// This rule designates a variable as the chosen alias for `this`.
33-
'consistent-this': [1, 'self'],
33+
'consistent-this': ['warn', 'self'],
3434

3535
// Enforce Function Style
3636
// Due to these different behaviors, it is common to have guidelines as to which style of
3737
// function should be used. There is really no correct or incorrect choice here, it is just a
3838
// preference. A good reason to use function declarations is that the function names then appear
3939
// in stack traces which help during debugging.
4040
// Allow arrow functions to be saved into variables
41-
'func-style': [1, 'declaration', {
41+
'func-style': ['warn', 'declaration', {
4242
allowArrowFunctions: true,
4343
}],
4444

4545
// Require function names to match the name of the variable to which they are assigned
46-
'func-name-matching': 1,
46+
'func-name-matching': 'warn',
4747

4848
// Limit minimum and maximum length for identifiers
4949
// This rule is aimed at increasing code readability and maintainability by enforcing an
5050
// identifier length convention.
51-
'id-length': [1, {
51+
'id-length': ['warn', {
5252
min: 2,
5353
max: 25,
5454
exceptions: [
@@ -61,95 +61,95 @@ module.exports = {
6161
// Very long lines of code in any language can be difficult to read. In order to aid in
6262
// readability and maintainability many coders have developed a convention to limit lines of
6363
// code to a certain number of characters.
64-
'max-len': [1, 100, 2],
64+
'max-len': ['warn', 100, 2],
6565

6666
// Limit Maximum Number of Parameters
6767
// Functions that take numerous parameters can be difficult to read and write because it
6868
// requires the memorization of what each parameter is, its type, and the order they should
6969
// appear in.
70-
'max-params': [1, 4],
70+
'max-params': ['warn', 4],
7171

7272
// Set Maximum Depth of Nested Callbacks
7373
// This rule is aimed at increasing code clarity by discouraging deeply nesting callbacks.
74-
'max-nested-callbacks': [1, 4],
74+
'max-nested-callbacks': ['warn', 4],
7575

7676
// Specify the Maximum Number of Statements Allowed per Line
7777
// A line of code containing too many statements can be difficult to read. Code is generally
7878
// read from the top down, especially when scanning, so limiting the number of statements
7979
// allowed on a single line can be very beneficial for readability and maintainability.
80-
'max-statements-per-line': 1,
80+
'max-statements-per-line': 'warn',
8181

8282
// Require Constructors to Use Initial Caps
8383
// This rule is aimed at helping to distinguish regular functions from constructor functions. As
8484
// such, it warns whenever it sees new followed by an identifier that isn't capitalized or
8585
// whenever it sees capitalized function called directly without new operator.
86-
'new-cap': [1, {
86+
'new-cap': ['warn', {
8787
newIsCap: true,
8888
capIsNew: true,
8989
}],
9090

9191
// Newline Per Chained Method Call
9292
// This rule checks and reports the chained calls if there are no new lines after each call or
9393
// deep member access.
94-
'newline-per-chained-call': [1, {
94+
'newline-per-chained-call': ['warn', {
9595
ignoreChainWithDepth: 3,
9696
}],
9797

9898
// Disallow duplicate exports/imports
9999
// An ES6/ES2015 import can be spread over multiple lines, but this takes up unneeded
100100
// whitespace. This rules validates that all imports from a single module exists in a single
101101
// import statement.
102-
'no-duplicate-imports': [1, {
102+
'no-duplicate-imports': ['warn', {
103103
includeExports: true,
104104
}],
105105

106106
// Disallows comments after code
107107
// This rule will disallow comments on the same line as code.
108-
'no-inline-comments': 1,
108+
'no-inline-comments': 'warn',
109109

110110
// Disallow mixes of different operators
111111
// Enclosing complex expressions by parentheses clarifies the developer’s intention, which makes
112112
// the code more readable. This rule warns when different operators are used consecutively
113113
// without parentheses in an expression.
114-
'no-mixed-operators': 1,
114+
'no-mixed-operators': 'warn',
115115

116116
// Disallow mixed spaces and tabs for indentation
117117
// The no-mixed-spaces-and-tabs rule is aimed at flagging any lines of code that are indented
118118
// with a mixture of tabs and spaces.
119-
'no-mixed-spaces-and-tabs': 1,
119+
'no-mixed-spaces-and-tabs': 'warn',
120120

121121
// Disallow tabs
122122
// Use of tabs is discouraged in favour of spaces because there is no "standard" width for a tab
123123
// character and many viewers/editors use their own tab width, which could cause code to be
124124
// misaligned and not formatted as intended/indented.
125-
'no-tabs': 1,
125+
'no-tabs': 'warn',
126126

127127
// Disallow Nested Ternaries
128128
// The no-nested-ternary rule aims to increase the clarity and readability of code by
129129
// disallowing the use of nested ternary expressions.
130-
'no-nested-ternary': 2,
130+
'no-nested-ternary': 'error',
131131

132132
// Disallow Dangling Underscores in Identifiers
133-
'no-underscore-dangle': 1,
133+
'no-underscore-dangle': 'warn',
134134

135135
// Disallow Warning Comments
136136
// These comments are a warning signal, that there is something not production ready in your
137137
// code. Most likely you want to fix it or remove the comments before you roll out your code
138138
// with a good feeling.
139-
'no-warning-comments': [1, {
139+
'no-warning-comments': ['warn', {
140140
location: 'anywhere',
141141
}],
142142

143143
// Require or Disallow One Variable Declaration per Scope
144144
// This rule is aimed at enforcing the use of one variable declaration per function (for var)
145145
// and multiple variable declaration per block (for let and const) scope.
146-
'one-var': [1, {
146+
'one-var': ['warn', {
147147
var: 'always',
148148
let: 'never',
149149
const: 'never',
150150
}],
151151

152152
// Enforces having an empty line after the last top-level import statement or require call
153-
'import/newline-after-import': 1,
153+
'import/newline-after-import': 'warn',
154154
},
155155
}

coding-styles/torment.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,43 +20,43 @@ module.exports = {
2020
rules: {
2121
// Enforce/Disallow Variable Initializations
2222
// You think you can get away with uninitialised variables? Hah! Forget it, dude!
23-
'init-declarations': 1,
23+
'init-declarations': 'warn',
2424

2525
// Disallow Shadowing of Variables Inside of catch
2626
// No. Make up a new variable name.
27-
'no-catch-shadow': 1,
27+
'no-catch-shadow': 'warn',
2828

2929
// Limit Maximum Number of Statements
3030
// Hit this limit? You are doing it wrong -> refactor!
31-
'max-statements': [1, 15],
31+
'max-statements': ['warn', 15],
3232

3333
// Require newline before return statement
3434
// Make your returns obvious!
35-
'newline-before-return': 1,
35+
'newline-before-return': 'warn',
3636

3737
// Disallow use of negated expressions in conditions
38-
'no-negated-condition': 1,
38+
'no-negated-condition': 'warn',
3939

4040
// Import Sorting
4141
// Of course you should sort your imports! It makes your code look more like poetry!
42-
'sort-imports': 1,
42+
'sort-imports': 'warn',
4343

4444
// Object key sorting
4545
// And of course you should sort your keys, who wants to look at such ugly, unsorted objects?
46-
'sort-keys': 1,
46+
'sort-keys': 'warn',
4747

4848
// Variable Sorting
4949
// Sort all the things!
50-
'sort-vars': 1,
50+
'sort-vars': 'warn',
5151

5252
// Disallow Magic Numbers
5353
// Nope. Define them as constants. Or something.
54-
'no-magic-numbers': 2,
54+
'no-magic-numbers': 'error',
5555

5656
// Require Radix Parameter
57-
radix: 1,
57+
radix: 'warn',
5858

5959
// Require Regex Literals to be Wrapped
60-
'wrap-regex': 1,
60+
'wrap-regex': 'warn',
6161
},
6262
}

environments/nodejs/optional.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ module.exports = {
2222
//
2323
// @see https://www.npmjs.com/package/debug
2424
// @see https://www.npmjs.com/package/bunyan
25-
'no-console': 1,
25+
'no-console': 'warn',
2626
},
2727
}

environments/nodejs/recommended.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ module.exports = {
1717
// It's arguably harder to identify dependencies when they are deeply nested inside of functions
1818
// and other statements. Since require() does a synchronous load, it can cause performance
1919
// problems when used in other locations.
20-
'global-require': 1,
20+
'global-require': 'warn',
2121

2222
// Disallow new require
2323
// This rule aims to eliminate use of the `new require` expression.
24-
'no-new-require': 2,
24+
'no-new-require': 'error',
2525

2626
// Disallow string concatenation when using _dirname and _filename
2727
// This rule aims to prevent string concatenation of directory paths in Node.js to make sure
2828
// developers use a platform-independent way of creating paths (we feel you, Windows).
29-
'no-path-concat': 2,
29+
'no-path-concat': 'error',
3030

3131
// Disallow process.env
3232
// This rule is aimed at discouraging use of process.env to avoid global dependencies throughout
@@ -36,17 +36,17 @@ module.exports = {
3636
// turned off for a particular file/folder where project configuration is gathered and stored in
3737
// custom configuration objects which you then use throughout your app, but the use of
3838
// process.env outside of preparing configuration data should be discouraged.
39-
'no-process-env': 1,
39+
'no-process-env': 'warn',
4040

4141
// Disallow `process.exit()`
4242
// It's better to throw an error and allow the application to handle it appropriately. Unhandled
4343
// errors always exit the process, but contrary to `process.exit()` they also print a stack
4444
// trace.
45-
'no-process-exit': 2,
45+
'no-process-exit': 'error',
4646

4747
// Disallow Synchronous Methods
4848
// This rule is aimed at preventing synchronous methods from being called in Node.js. It looks
4949
// specifically for the method suffix "Sync" (as is the convention with Node.js operations).
50-
'no-sync': 1,
50+
'no-sync': 'warn',
5151
},
5252
}

environments/react/optional.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ module.exports = {
1616
// Disallow Use of Alert
1717
// This rule is aimed at catching debugging code that should be removed and popup UI elements
1818
// that should be replaced with less obtrusive, custom UIs.
19-
'no-alert': 1,
19+
'no-alert': 'warn',
2020

2121
// Enforce propTypes declarations alphabetical sorting
22-
'react/sort-prop-types': [1, {
22+
'react/sort-prop-types': ['warn', {
2323
ignoreCase: true,
2424
callbacksLast: false,
2525
requiredFirst: false,
@@ -30,6 +30,6 @@ module.exports = {
3030
// imported/exported. This allows people who want to use
3131
// babel-plugin-transform-react-remove-prop-types to remove propTypes from their components in
3232
// production builds, to do so safely
33-
'react/forbid-foreign-prop-types': 1,
33+
'react/forbid-foreign-prop-types': 'warn',
3434
},
3535
}

0 commit comments

Comments
 (0)