@jobscale/eslint-plugin-standard 0.0.1 → 0.0.2

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/index.js CHANGED
@@ -1,39 +1,93 @@
1
- import globals from "globals";
2
- import pluginJs from "@eslint/js";
1
+ import globals from 'globals';
2
+ import pluginJs from '@eslint/js';
3
+ import importPlugin from 'eslint-plugin-import';
4
+ import airbnbPractices from './rules/best-practices.js';
5
+ import airbnbStrict from './rules/strict.js';
6
+ import airbnbEs6 from './rules/es6.js';
7
+ import airbnbErrors from './rules/errors.js';
8
+ import airbnbNode from './rules/node.js';
3
9
 
4
- import airbnb1 from "./rules/best-practices.js";
5
- import airbnb2 from "./rules/strict.js";
6
- import airbnb3 from "./rules/es6.js";
7
- import airbnb4 from "./rules/errors.js";
8
- import airbnb5 from "./rules/node.js";
10
+ const rules = {
11
+ indent: ['error', 2, { MemberExpression: 0 }],
12
+ quotes: ['error', 'single', { avoidEscape: true }],
13
+ camelcase: ['error', { properties: 'never' }],
14
+ semi: ['error', 'always'],
15
+ eqeqeq: ['error', 'always'],
16
+ 'class-methods-use-this': 'off',
17
+ 'no-await-in-loop': 'off',
18
+ 'arrow-parens': 'off',
19
+ 'comma-dangle': ['error', 'always-multiline'],
20
+ 'quote-props': ['error', 'as-needed'],
21
+ 'no-multiple-empty-lines': ['error', { max: 1, maxEOF: 0 }],
22
+ 'padded-blocks': ['error', 'never'],
23
+ 'linebreak-style': ['error', 'unix'],
24
+ 'no-trailing-spaces': ['error'],
25
+ 'object-curly-newline': ['error', {
26
+ ObjectExpression: { minProperties: 6, multiline: true, consistent: true },
27
+ ObjectPattern: { minProperties: 6, multiline: true, consistent: true },
28
+ ImportDeclaration: { minProperties: 6, multiline: true, consistent: true },
29
+ ExportDeclaration: { minProperties: 6, multiline: true, consistent: true },
30
+ }],
31
+
32
+ // --- JavaScript coding style rule ---
33
+ 'array-bracket-spacing': ['error', 'never'],
34
+ 'block-spacing': ['error', 'always'],
35
+ 'comma-spacing': ['error', { before: false, after: true }],
36
+ 'func-call-spacing': ['error', 'never'],
37
+ 'key-spacing': ['error', { beforeColon: false, afterColon: true }],
38
+ 'keyword-spacing': ['error', { before: true, after: true }],
39
+ 'lines-between-class-members': ['error', 'always'],
40
+ 'no-debugger': ['error'],
41
+ 'no-multi-spaces': ['error'],
42
+ 'object-curly-spacing': ['error', 'always'],
43
+ 'space-before-blocks': ['error', 'always'],
44
+ 'space-in-parens': ['error', 'never'],
45
+ 'space-infix-ops': ['error'],
46
+ 'spaced-comment': ['error', 'always'],
47
+ 'no-shadow': 'error',
48
+ 'no-console': ['warn'],
49
+ 'no-restricted-syntax': ['error', {
50
+ selector: "CallExpression[callee.name='Number']",
51
+ message: 'using to Number.parseInt, Number.parseFloat',
52
+ }],
53
+
54
+ // --- import rule ---
55
+ 'import/named': ['error'],
56
+ 'import/default': ['error'],
57
+ 'import/order': ['error'],
58
+ 'import/no-duplicates': ['error'],
59
+ 'import/newline-after-import': ['error'],
60
+ 'import/no-mutable-exports': ['error'],
61
+ };
9
62
 
10
63
  const recommended = {
11
- name: "eslint-plugin-standard/recommended",
12
- files: ["**/*.{js,mjs}"],
64
+ name: 'eslint-plugin-standard/recommended',
65
+ files: ['**/*.{js,mjs,cjs}'],
13
66
  languageOptions: {
14
67
  ecmaVersion: 'latest',
15
- sourceType: "module",
68
+ sourceType: 'module',
16
69
  globals: {
17
70
  ...globals.browser,
18
71
  ...globals.node,
19
72
  ...globals.jest,
20
73
  },
21
74
  },
75
+ plugins: {
76
+ import: importPlugin,
77
+ },
22
78
  rules: {
23
- ...airbnb1.rules,
24
- ...airbnb2.rules,
25
- ...airbnb3.rules,
26
- ...airbnb4.rules,
27
- ...airbnb5.rules,
28
- indent: ["error", 2, { MemberExpression: 0 }],
29
- "class-methods-use-this": "off",
30
- "no-await-in-loop": "off",
31
- "arrow-parens": "off",
79
+ ...airbnbPractices.rules,
80
+ ...airbnbStrict.rules,
81
+ ...airbnbEs6.rules,
82
+ ...airbnbErrors.rules,
83
+ ...airbnbNode.rules,
84
+ ...rules,
32
85
  },
33
86
  };
34
87
 
35
88
  const standard = {
36
89
  ...recommended,
90
+ name: 'eslint-plugin-standard/standard',
37
91
  rules: {
38
92
  ...pluginJs.configs.recommended.rules,
39
93
  ...recommended.rules,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobscale/eslint-plugin-standard",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "eslint plugin standard",
5
5
  "keywords": [
6
6
  "eslint",
@@ -96,7 +96,7 @@ export default {
96
96
  'arrowFunctions',
97
97
  'functions',
98
98
  'methods',
99
- ]
99
+ ],
100
100
  }],
101
101
 
102
102
  // disallow empty destructuring patterns
@@ -237,7 +237,7 @@ export default {
237
237
  'response', // for Express responses
238
238
  '$scope', // for Angular 1 scopes
239
239
  'staticContext', // for ReactRouter context
240
- ]
240
+ ],
241
241
  }],
242
242
 
243
243
  // disallow usage of __proto__ property
@@ -403,6 +403,6 @@ export default {
403
403
 
404
404
  // require or disallow Yoda conditions
405
405
  // https://eslint.org/docs/rules/yoda
406
- yoda: 'error'
407
- }
406
+ yoda: 'error',
407
+ },
408
408
  };
package/rules/errors.js CHANGED
@@ -175,5 +175,5 @@ export default {
175
175
  // ensure that the results of typeof are compared against a valid string
176
176
  // https://eslint.org/docs/rules/valid-typeof
177
177
  'valid-typeof': ['error', { requireStringLiterals: true }],
178
- }
178
+ },
179
179
  };
package/rules/es6.js CHANGED
@@ -1,14 +1,14 @@
1
1
  export default {
2
2
  env: {
3
- es6: true
3
+ es6: true,
4
4
  },
5
5
  parserOptions: {
6
6
  ecmaVersion: 6,
7
7
  sourceType: 'module',
8
8
  ecmaFeatures: {
9
9
  generators: false,
10
- objectLiteralDuplicateProperties: false
11
- }
10
+ objectLiteralDuplicateProperties: false,
11
+ },
12
12
  },
13
13
 
14
14
  rules: {
@@ -73,7 +73,7 @@ export default {
73
73
  // https://eslint.org/docs/rules/no-restricted-imports
74
74
  'no-restricted-imports': ['off', {
75
75
  paths: [],
76
- patterns: []
76
+ patterns: [],
77
77
  }],
78
78
 
79
79
  // disallow to use this/super before super() calling in constructors.
@@ -180,6 +180,6 @@ export default {
180
180
 
181
181
  // enforce spacing around the * in yield* expressions
182
182
  // https://eslint.org/docs/rules/yield-star-spacing
183
- 'yield-star-spacing': ['error', 'after']
184
- }
183
+ 'yield-star-spacing': ['error', 'after'],
184
+ },
185
185
  };
package/rules/node.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  env: {
3
- node: true
3
+ node: true,
4
4
  },
5
5
 
6
6
  rules: {
@@ -39,5 +39,5 @@ export default {
39
39
 
40
40
  // disallow use of synchronous methods (off by default)
41
41
  'no-sync': 'off',
42
- }
42
+ },
43
43
  };
package/rules/strict.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  rules: {
3
3
  // babel inserts `'use strict';` for us
4
- strict: ['error', 'never']
5
- }
4
+ strict: ['error', 'never'],
5
+ },
6
6
  };