@cookshack/eslint-config 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +28 -1
- package/dist/index.js +29 -2
- package/index.js +28 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2,7 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
var globals = require('globals');
|
|
4
4
|
|
|
5
|
-
exports.rules = void 0; exports.languageOptions = void 0;
|
|
5
|
+
exports.rules = void 0; exports.languageOptions = void 0; exports.plugins = void 0;
|
|
6
|
+
|
|
7
|
+
exports.plugins = { 'cookshack': { rules: { 'no-logical-not': { meta: { type: 'problem',
|
|
8
|
+
docs: { description: 'Prevent !.' },
|
|
9
|
+
messages: { logicalNot: 'Logical not used.',
|
|
10
|
+
inequality: 'Inequality operator used.',
|
|
11
|
+
strictInequality: 'Strict inequality operator used.' },
|
|
12
|
+
schema: [] }, // options
|
|
13
|
+
create(context) {
|
|
14
|
+
return {
|
|
15
|
+
UnaryExpression(node) {
|
|
16
|
+
if (node.operator == '!')
|
|
17
|
+
context.report({ node,
|
|
18
|
+
messageId: 'logicalNot' });
|
|
19
|
+
},
|
|
20
|
+
BinaryExpression(node) {
|
|
21
|
+
if (node.operator == '!=')
|
|
22
|
+
context.report({ node,
|
|
23
|
+
messageId: 'inequality' });
|
|
24
|
+
else if (node.operator == '!==')
|
|
25
|
+
context.report({ node,
|
|
26
|
+
messageId: 'strictInequality' });
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
} } } } };
|
|
6
30
|
|
|
7
31
|
exports.rules = {
|
|
8
32
|
'array-bracket-newline': [ 'error', 'never' ],
|
|
@@ -32,8 +56,11 @@ exports.rules = {
|
|
|
32
56
|
{ blankLine: 'never', prev: 'let', next: 'let' } ],
|
|
33
57
|
'no-case-declarations': 'error',
|
|
34
58
|
'no-global-assign': 'error',
|
|
59
|
+
'cookshack/no-logical-not': 'error',
|
|
35
60
|
'no-multi-spaces': 'error',
|
|
36
61
|
'no-multiple-empty-lines': [ 'error', { max: 1, maxEOF: 0 } ],
|
|
62
|
+
'no-negated-condition': 'error',
|
|
63
|
+
'no-unsafe-negation': 'error',
|
|
37
64
|
'no-redeclare': 'error',
|
|
38
65
|
'no-tabs': 'error',
|
|
39
66
|
'no-trailing-spaces': 'error',
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
import globals from 'globals';
|
|
2
2
|
|
|
3
|
-
let rules, languageOptions;
|
|
3
|
+
let rules, languageOptions, plugins;
|
|
4
|
+
|
|
5
|
+
plugins = { 'cookshack': { rules: { 'no-logical-not': { meta: { type: 'problem',
|
|
6
|
+
docs: { description: 'Prevent !.' },
|
|
7
|
+
messages: { logicalNot: 'Logical not used.',
|
|
8
|
+
inequality: 'Inequality operator used.',
|
|
9
|
+
strictInequality: 'Strict inequality operator used.' },
|
|
10
|
+
schema: [] }, // options
|
|
11
|
+
create(context) {
|
|
12
|
+
return {
|
|
13
|
+
UnaryExpression(node) {
|
|
14
|
+
if (node.operator == '!')
|
|
15
|
+
context.report({ node,
|
|
16
|
+
messageId: 'logicalNot' });
|
|
17
|
+
},
|
|
18
|
+
BinaryExpression(node) {
|
|
19
|
+
if (node.operator == '!=')
|
|
20
|
+
context.report({ node,
|
|
21
|
+
messageId: 'inequality' });
|
|
22
|
+
else if (node.operator == '!==')
|
|
23
|
+
context.report({ node,
|
|
24
|
+
messageId: 'strictInequality' });
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
} } } } };
|
|
4
28
|
|
|
5
29
|
rules = {
|
|
6
30
|
'array-bracket-newline': [ 'error', 'never' ],
|
|
@@ -30,8 +54,11 @@ rules = {
|
|
|
30
54
|
{ blankLine: 'never', prev: 'let', next: 'let' } ],
|
|
31
55
|
'no-case-declarations': 'error',
|
|
32
56
|
'no-global-assign': 'error',
|
|
57
|
+
'cookshack/no-logical-not': 'error',
|
|
33
58
|
'no-multi-spaces': 'error',
|
|
34
59
|
'no-multiple-empty-lines': [ 'error', { max: 1, maxEOF: 0 } ],
|
|
60
|
+
'no-negated-condition': 'error',
|
|
61
|
+
'no-unsafe-negation': 'error',
|
|
35
62
|
'no-redeclare': 'error',
|
|
36
63
|
'no-tabs': 'error',
|
|
37
64
|
'no-trailing-spaces': 'error',
|
|
@@ -55,4 +82,4 @@ languageOptions = {
|
|
|
55
82
|
},
|
|
56
83
|
};
|
|
57
84
|
|
|
58
|
-
export { languageOptions, rules };
|
|
85
|
+
export { languageOptions, plugins, rules };
|
package/index.js
CHANGED
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
import globals from 'globals'
|
|
2
2
|
|
|
3
|
-
export let rules, languageOptions
|
|
3
|
+
export let rules, languageOptions, plugins
|
|
4
|
+
|
|
5
|
+
plugins = { 'cookshack': { rules: { 'no-logical-not': { meta: { type: 'problem',
|
|
6
|
+
docs: { description: 'Prevent !.' },
|
|
7
|
+
messages: { logicalNot: 'Logical not used.',
|
|
8
|
+
inequality: 'Inequality operator used.',
|
|
9
|
+
strictInequality: 'Strict inequality operator used.' },
|
|
10
|
+
schema: [] }, // options
|
|
11
|
+
create(context) {
|
|
12
|
+
return {
|
|
13
|
+
UnaryExpression(node) {
|
|
14
|
+
if (node.operator == '!')
|
|
15
|
+
context.report({ node,
|
|
16
|
+
messageId: 'logicalNot' })
|
|
17
|
+
},
|
|
18
|
+
BinaryExpression(node) {
|
|
19
|
+
if (node.operator == '!=')
|
|
20
|
+
context.report({ node,
|
|
21
|
+
messageId: 'inequality' })
|
|
22
|
+
else if (node.operator == '!==')
|
|
23
|
+
context.report({ node,
|
|
24
|
+
messageId: 'strictInequality' })
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
} } } } }
|
|
4
28
|
|
|
5
29
|
rules = {
|
|
6
30
|
'array-bracket-newline': [ 'error', 'never' ],
|
|
@@ -30,8 +54,11 @@ rules = {
|
|
|
30
54
|
{ blankLine: 'never', prev: 'let', next: 'let' } ],
|
|
31
55
|
'no-case-declarations': 'error',
|
|
32
56
|
'no-global-assign': 'error',
|
|
57
|
+
'cookshack/no-logical-not': 'error',
|
|
33
58
|
'no-multi-spaces': 'error',
|
|
34
59
|
'no-multiple-empty-lines': [ 'error', { max: 1, maxEOF: 0 } ],
|
|
60
|
+
'no-negated-condition': 'error',
|
|
61
|
+
'no-unsafe-negation': 'error',
|
|
35
62
|
'no-redeclare': 'error',
|
|
36
63
|
'no-tabs': 'error',
|
|
37
64
|
'no-trailing-spaces': 'error',
|