@innovixx/eslint-config 1.0.0

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.
@@ -0,0 +1,176 @@
1
+ module.exports = {
2
+ env: {
3
+ es6: true,
4
+ },
5
+ parserOptions: {
6
+ ecmaVersion: 6,
7
+ sourceType: 'module',
8
+ ecmaFeatures: {
9
+ generators: false,
10
+ objectLiteralDuplicateProperties: false,
11
+ },
12
+ },
13
+ rules: {
14
+ // enforces no braces where they can be omitted
15
+ // https://eslint.org/docs/rules/arrow-body-style
16
+ 'arrow-body-style': ['error', 'as-needed', {
17
+ requireReturnForObjectLiteral: false,
18
+ }],
19
+
20
+ // require parens in arrow function arguments
21
+ // https://eslint.org/docs/rules/arrow-parens
22
+ 'arrow-parens': ['error', 'always'],
23
+
24
+ // require space before/after arrow function's arrow
25
+ // https://eslint.org/docs/rules/arrow-spacing
26
+ 'arrow-spacing': ['error', { before: true, after: true }],
27
+
28
+ // verify super() callings in constructors
29
+ 'constructor-super': 'error',
30
+
31
+ // enforce the spacing around the * in generator functions
32
+ // https://eslint.org/docs/rules/generator-star-spacing
33
+ 'generator-star-spacing': ['error', { before: false, after: true }],
34
+
35
+ // disallow modifying variables of class declarations
36
+ // https://eslint.org/docs/rules/no-class-assign
37
+ 'no-class-assign': 'error',
38
+
39
+ // disallow arrow functions where they could be confused with comparisons
40
+ // https://eslint.org/docs/rules/no-confusing-arrow
41
+ 'no-confusing-arrow': ['error', {
42
+ allowParens: true,
43
+ }],
44
+
45
+ // disallow modifying variables that are declared using const
46
+ 'no-const-assign': 'error',
47
+
48
+ // disallow duplicate class members
49
+ // https://eslint.org/docs/rules/no-dupe-class-members
50
+ 'no-dupe-class-members': 'error',
51
+
52
+ // disallow importing from the same path more than once
53
+ // https://eslint.org/docs/rules/no-duplicate-imports
54
+ // replaced by https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md
55
+ 'no-duplicate-imports': 'off',
56
+
57
+ // disallow symbol constructor
58
+ // https://eslint.org/docs/rules/no-new-symbol
59
+ 'no-new-symbol': 'error',
60
+
61
+ // disallow specific imports
62
+ // https://eslint.org/docs/rules/no-restricted-imports
63
+ 'no-restricted-imports': ['off', {
64
+ paths: [],
65
+ patterns: [],
66
+ }],
67
+
68
+ // disallow to use this/super before super() calling in constructors.
69
+ // https://eslint.org/docs/rules/no-this-before-super
70
+ 'no-this-before-super': 'error',
71
+
72
+ // disallow useless computed property keys
73
+ // https://eslint.org/docs/rules/no-useless-computed-key
74
+ 'no-useless-computed-key': 'error',
75
+
76
+ // disallow unnecessary constructor
77
+ // https://eslint.org/docs/rules/no-useless-constructor
78
+ 'no-useless-constructor': 'error',
79
+
80
+ // disallow renaming import, export, and destructured assignments to the same name
81
+ // https://eslint.org/docs/rules/no-useless-rename
82
+ 'no-useless-rename': ['error', {
83
+ ignoreDestructuring: false,
84
+ ignoreImport: false,
85
+ ignoreExport: false,
86
+ }],
87
+
88
+ // require let or const instead of var
89
+ 'no-var': 'error',
90
+
91
+ // require method and property shorthand syntax for object literals
92
+ // https://eslint.org/docs/rules/object-shorthand
93
+ 'object-shorthand': ['error', 'always', {
94
+ ignoreConstructors: false,
95
+ avoidQuotes: true,
96
+ }],
97
+
98
+ // suggest using arrow functions as callbacks
99
+ 'prefer-arrow-callback': ['error', {
100
+ allowNamedFunctions: false,
101
+ allowUnboundThis: true,
102
+ }],
103
+
104
+ // suggest using of const declaration for variables that are never modified after declared
105
+ 'prefer-const': ['error', {
106
+ destructuring: 'any',
107
+ ignoreReadBeforeAssign: true,
108
+ }],
109
+
110
+ // Prefer destructuring from arrays and objects
111
+ // https://eslint.org/docs/rules/prefer-destructuring
112
+ 'prefer-destructuring': ['error',
113
+ {
114
+ VariableDeclarator: {
115
+ array: false,
116
+ object: true,
117
+ },
118
+ AssignmentExpression: {
119
+ array: true,
120
+ object: false,
121
+ },
122
+ }, {
123
+ enforceForRenamedProperties: false,
124
+ },
125
+ ],
126
+
127
+ // disallow parseInt() in favor of binary, octal, and hexadecimal literals
128
+ // https://eslint.org/docs/rules/prefer-numeric-literals
129
+ 'prefer-numeric-literals': 'error',
130
+
131
+ // suggest using Reflect methods where applicable
132
+ // https://eslint.org/docs/rules/prefer-reflect
133
+ 'prefer-reflect': 'off',
134
+
135
+ // use rest parameters instead of arguments
136
+ // https://eslint.org/docs/rules/prefer-rest-params
137
+ 'prefer-rest-params': 'error',
138
+
139
+ // suggest using the spread operator instead of .apply()
140
+ // https://eslint.org/docs/rules/prefer-spread
141
+ 'prefer-spread': 'error',
142
+
143
+ // suggest using template literals instead of string concatenation
144
+ // https://eslint.org/docs/rules/prefer-template
145
+ 'prefer-template': 'error',
146
+
147
+ // disallow generator functions that do not have yield
148
+ // https://eslint.org/docs/rules/require-yield
149
+ 'require-yield': 'error',
150
+
151
+ // enforce spacing between object rest-spread
152
+ // https://eslint.org/docs/rules/rest-spread-spacing
153
+ 'rest-spread-spacing': ['error', 'never'],
154
+
155
+ // import sorting
156
+ // https://eslint.org/docs/rules/sort-imports
157
+ 'sort-imports': ['off', {
158
+ ignoreCase: false,
159
+ ignoreDeclarationSort: false,
160
+ ignoreMemberSort: false,
161
+ memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
162
+ }],
163
+
164
+ // require a Symbol description
165
+ // https://eslint.org/docs/rules/symbol-description
166
+ 'symbol-description': 'error',
167
+
168
+ // enforce usage of spacing in template strings
169
+ // https://eslint.org/docs/rules/template-curly-spacing
170
+ 'template-curly-spacing': 'error',
171
+
172
+ // enforce spacing around the * in yield* expressions
173
+ // https://eslint.org/docs/rules/yield-star-spacing
174
+ 'yield-star-spacing': ['error', 'after'],
175
+ },
176
+ };
@@ -0,0 +1,234 @@
1
+ module.exports = {
2
+ env: {
3
+ es6: true,
4
+ },
5
+ parserOptions: {
6
+ ecmaVersion: 6,
7
+ sourceType: 'module',
8
+ },
9
+ plugins: [
10
+ 'import',
11
+ ],
12
+ settings: {
13
+ 'import/resolver': {
14
+ node: {
15
+ extensions: ['.mjs', '.js', '.json'],
16
+ },
17
+ },
18
+ 'import/extensions': [
19
+ '.js',
20
+ '.mjs',
21
+ '.jsx',
22
+ ],
23
+ 'import/core-modules': [],
24
+ 'import/ignore': [
25
+ 'node_modules',
26
+ '\\.(coffee|scss|css|less|hbs|svg|json)$',
27
+ ],
28
+ },
29
+ rules: {
30
+ // Static analysis:
31
+
32
+ // ensure imports point to files/modules that can be resolved
33
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unresolved.md
34
+ 'import/no-unresolved': ['error', { commonjs: true, caseSensitive: true }],
35
+
36
+ // ensure named imports coupled with named exports
37
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/named.md#when-not-to-use-it
38
+ 'import/named': 'error',
39
+
40
+ // ensure default import coupled with default export
41
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/default.md#when-not-to-use-it
42
+ 'import/default': 'off',
43
+
44
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/namespace.md
45
+ 'import/namespace': 'off',
46
+
47
+ // Helpful warnings:
48
+
49
+ // disallow invalid exports, e.g. multiple defaults
50
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/export.md
51
+ 'import/export': 'error',
52
+
53
+ // do not allow a default import name to match a named export
54
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-as-default.md
55
+ 'import/no-named-as-default': 'error',
56
+
57
+ // warn on accessing default export property names that are also named exports
58
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-as-default-member.md
59
+ 'import/no-named-as-default-member': 'error',
60
+
61
+ // disallow use of jsdoc-marked-deprecated imports
62
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-deprecated.md
63
+ 'import/no-deprecated': 'off',
64
+
65
+ // Forbid the use of extraneous packages
66
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-extraneous-dependencies.md
67
+ // paths are treated both as absolute paths, and relative to process.cwd()
68
+ 'import/no-extraneous-dependencies': ['error'],
69
+
70
+ // Forbid mutable exports
71
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-mutable-exports.md
72
+ 'import/no-mutable-exports': 'error',
73
+
74
+ // Module systems:
75
+
76
+ // disallow require()
77
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-commonjs.md
78
+ 'import/no-commonjs': 'off',
79
+
80
+ // disallow AMD require/define
81
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-amd.md
82
+ 'import/no-amd': 'error',
83
+
84
+ // No Node.js builtin modules
85
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-nodejs-modules.md
86
+ // TODO: enable?
87
+ 'import/no-nodejs-modules': 'off',
88
+
89
+ // Style guide:
90
+
91
+ // disallow non-import statements appearing before import statements
92
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/first.md
93
+ 'import/first': 'error',
94
+
95
+ // disallow non-import statements appearing before import statements
96
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/imports-first.md
97
+ // deprecated: use `import/first`
98
+ 'import/imports-first': 'off',
99
+
100
+ // disallow duplicate imports
101
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md
102
+ 'import/no-duplicates': 'error',
103
+
104
+ // disallow namespace imports
105
+ // TODO: enable?
106
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-namespace.md
107
+ 'import/no-namespace': 'off',
108
+
109
+ // Ensure consistent use of file extension within the import path
110
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/extensions.md
111
+ 'import/extensions': ['error', 'ignorePackages', {
112
+ js: 'never',
113
+ mjs: 'never',
114
+ jsx: 'never',
115
+ }],
116
+
117
+ // ensure absolute imports are above relative imports and that unassigned imports are ignored
118
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/order.md
119
+ // TODO: enforce a stricter convention in module import order?
120
+ 'import/order': ['error', { groups: [['builtin', 'external', 'internal']] }],
121
+
122
+ // Require a newline after the last import/require in a group
123
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/newline-after-import.md
124
+ 'import/newline-after-import': 'error',
125
+
126
+ // Require modules with a single export to use a default export
127
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/prefer-default-export.md
128
+ 'import/prefer-default-export': 'error',
129
+
130
+ // Restrict which files can be imported in a given folder
131
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-restricted-paths.md
132
+ 'import/no-restricted-paths': 'off',
133
+
134
+ // Forbid modules to have too many dependencies
135
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/max-dependencies.md
136
+ 'import/max-dependencies': ['off', { max: 10 }],
137
+
138
+ // Forbid import of modules using absolute paths
139
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-absolute-path.md
140
+ 'import/no-absolute-path': 'error',
141
+
142
+ // Forbid require() calls with expressions
143
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-dynamic-require.md
144
+ 'import/no-dynamic-require': 'error',
145
+
146
+ // prevent importing the submodules of other modules
147
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-internal-modules.md
148
+ 'import/no-internal-modules': ['off', {
149
+ allow: [],
150
+ }],
151
+
152
+ // Warn if a module could be mistakenly parsed as a script by a consumer
153
+ // leveraging Unambiguous JavaScript Grammar
154
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/unambiguous.md
155
+ // this should not be enabled until this proposal has at least been *presented* to TC39.
156
+ // At the moment, it's not a thing.
157
+ 'import/unambiguous': 'off',
158
+
159
+ // Forbid Webpack loader syntax in imports
160
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-webpack-loader-syntax.md
161
+ 'import/no-webpack-loader-syntax': 'error',
162
+
163
+ // Prevent unassigned imports
164
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unassigned-import.md
165
+ // importing for side effects is perfectly acceptable, if you need side effects.
166
+ 'import/no-unassigned-import': 'off',
167
+
168
+ // Prevent importing the default as if it were named
169
+ // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-default.md
170
+ 'import/no-named-default': 'error',
171
+
172
+ // Reports if a module's default export is unnamed
173
+ // https://github.com/benmosher/eslint-plugin-import/blob/d9b712ac7fd1fddc391f7b234827925c160d956f/docs/rules/no-anonymous-default-export.md
174
+ 'import/no-anonymous-default-export': ['off', {
175
+ allowArray: false,
176
+ allowArrowFunction: false,
177
+ allowAnonymousClass: false,
178
+ allowAnonymousFunction: false,
179
+ allowLiteral: false,
180
+ allowObject: false,
181
+ }],
182
+
183
+ // This rule enforces that all exports are declared at the bottom of the file.
184
+ // https://github.com/benmosher/eslint-plugin-import/blob/98acd6afd04dcb6920b81330114e146dc8532ea4/docs/rules/exports-last.md
185
+ // TODO: enable?
186
+ 'import/exports-last': 'off',
187
+
188
+ // Reports when named exports are not grouped together in a single export declaration
189
+ // or when multiple assignments to CommonJS module.exports or exports object are present
190
+ // in a single file.
191
+ // https://github.com/benmosher/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/group-exports.md
192
+ 'import/group-exports': 'off',
193
+
194
+ // forbid default exports. this is a terrible rule, do not use it.
195
+ // https://github.com/benmosher/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/no-default-export.md
196
+ 'import/no-default-export': 'off',
197
+
198
+ // Prohibit named exports. this is a terrible rule, do not use it.
199
+ // https://github.com/benmosher/eslint-plugin-import/blob/1ec80fa35fa1819e2d35a70e68fb6a149fb57c5e/docs/rules/no-named-export.md
200
+ 'import/no-named-export': 'off',
201
+
202
+ // Forbid a module from importing itself
203
+ // https://github.com/benmosher/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/no-self-import.md
204
+ 'import/no-self-import': 'error',
205
+
206
+ // Forbid cyclical dependencies between modules
207
+ // https://github.com/benmosher/eslint-plugin-import/blob/d81f48a2506182738409805f5272eff4d77c9348/docs/rules/no-cycle.md
208
+ 'import/no-cycle': ['error', { maxDepth: Infinity }],
209
+
210
+ // Ensures that there are no useless path segments
211
+ // https://github.com/benmosher/eslint-plugin-import/blob/ebafcbf59ec9f653b2ac2a0156ca3bcba0a7cf57/docs/rules/no-useless-path-segments.md
212
+ 'import/no-useless-path-segments': ['error', { commonjs: true }],
213
+
214
+ // dynamic imports require a leading comment with a webpackChunkName
215
+ // https://github.com/benmosher/eslint-plugin-import/blob/ebafcbf59ec9f653b2ac2a0156ca3bcba0a7cf57/docs/rules/dynamic-import-chunkname.md
216
+ 'import/dynamic-import-chunkname': ['off', {
217
+ importFunctions: [],
218
+ webpackChunknameFormat: '[0-9a-zA-Z-_/.]+',
219
+ }],
220
+
221
+ // Use this rule to prevent imports to folders in relative parent paths.
222
+ // https://github.com/benmosher/eslint-plugin-import/blob/c34f14f67f077acd5a61b3da9c0b0de298d20059/docs/rules/no-relative-parent-imports.md
223
+ 'import/no-relative-parent-imports': 'off',
224
+
225
+ // Reports modules without any exports, or with unused exports
226
+ // https://github.com/benmosher/eslint-plugin-import/blob/f63dd261809de6883b13b6b5b960e6d7f42a7813/docs/rules/no-unused-modules.md
227
+ // TODO: enable, semver-major
228
+ 'import/no-unused-modules': ['off', {
229
+ ignoreExports: [],
230
+ missingExports: true,
231
+ unusedExports: true,
232
+ }],
233
+ },
234
+ };