UNPKG

5.84 kBJavaScriptView Raw
1module.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
14 rules: {
15 // require braces around arrow function bodies
16 // http://eslint.org/docs/rules/arrow-body-style
17 'arrow-body-style': ['error', 'as-needed', {
18 requireReturnForObjectLiteral: true,
19 }],
20
21 // require parentheses around arrow function arguments
22 // http://eslint.org/docs/rules/arrow-parens
23 // This is handled by Prettier in Defaults 2.0
24 'arrow-parens': 'off',
25
26 // enforce consistent spacing before and after the arrow in arrow functions
27 // http://eslint.org/docs/rules/arrow-spacing
28 // This is handled by Prettier in Defaults 2.0
29 'arrow-spacing': 'off',
30
31 // require super() calls in constructors
32 // http://eslint.org/docs/rules/constructor-super
33 'constructor-super': 'error',
34
35 // enforce consistent spacing around * operators in generator functions
36 // http://eslint.org/docs/rules/generator-star-spacing
37 // This is handled by Prettier in Defaults 2.0
38 'generator-star-spacing': 'off',
39
40 // disallow reassigning class members
41 // http://eslint.org/docs/rules/no-class-assign
42 'no-class-assign': 'error',
43
44 // disallow arrow functions where they could be confused with comparisons
45 // http://eslint.org/docs/rules/no-confusing-arrow
46 // This is handled by Prettier in Defaults 2.0
47 'no-confusing-arrow': 'off',
48
49 // disallow reassigning const variables
50 // http://eslint.org/docs/rules/no-const-assign
51 'no-const-assign': 'error',
52
53 // disallow duplicate class members
54 // http://eslint.org/docs/rules/no-dupe-class-members
55 'no-dupe-class-members': 'error',
56
57 // disallow duplicate module imports
58 // http://eslint.org/docs/rules/no-duplicate-imports
59 'no-duplicate-imports': 'off',
60
61 // disallow new operators with the Symbol object
62 // http://eslint.org/docs/rules/no-new-symbol
63 'no-new-symbol': 'error',
64
65 // disallow specified modules when loaded by import
66 // http://eslint.org/docs/rules/no-restricted-imports
67 'no-restricted-imports': 'off',
68
69 // disallow this/super before calling super() in constructors
70 // http://eslint.org/docs/rules/no-this-before-super
71 'no-this-before-super': 'error',
72
73 // disallow unnecessary computed property keys in object literals
74 // http://eslint.org/docs/rules/no-useless-computed-key
75 'no-useless-computed-key': 'error',
76
77 // disallow unnecessary constructors
78 // http://eslint.org/docs/rules/no-useless-constructor
79 'no-useless-constructor': 'error',
80
81 // disallow renaming import, export, and destructured assignments to the same name
82 // http://eslint.org/docs/rules/no-useless-rename
83 'no-useless-rename': ['error', {
84 ignoreDestructuring: false,
85 ignoreImport: false,
86 ignoreExport: false,
87 }],
88
89 // require let or const instead of var
90 // http://eslint.org/docs/rules/no-var
91 'no-var': 'error',
92
93 // require or disallow method and property shorthand syntax for object literals
94 // http://eslint.org/docs/rules/object-shorthand
95 'object-shorthand': ['error', 'always', {
96 ignoreConstructors: false,
97 avoidQuotes: true,
98 }],
99
100 // require arrow functions as callbacks
101 // http://eslint.org/docs/rules/prefer-arrow-callback
102 'prefer-arrow-callback': ['warn', {
103 allowNamedFunctions: false,
104 allowUnboundThis: true,
105 }],
106
107 // require const declarations for variables that are never reassigned after declared
108 // http://eslint.org/docs/rules/prefer-const
109 'prefer-const': ['error', {
110 destructuring: 'any',
111 ignoreReadBeforeAssign: true,
112 }],
113
114 // require destructuring from arrays and/or objects
115 // http://eslint.org/docs/rules/prefer-destructuring
116 'prefer-destructuring': ['warn', {
117 array: true,
118 object: true,
119 }, {
120 enforceForRenamedProperties: false,
121 }],
122
123 // disallow parseInt() in favor of binary, octal, and hexadecimal literals
124 // http://eslint.org/docs/rules/prefer-numeric-literals
125 'prefer-numeric-literals': 'error',
126
127 // require rest parameters instead of arguments
128 // http://eslint.org/docs/rules/prefer-rest-params
129 'prefer-rest-params': 'error',
130
131 // require spread operators instead of .apply()
132 // http://eslint.org/docs/rules/prefer-spread
133 'prefer-spread': 'error',
134
135 // require template literals instead of string concatenation
136 // http://eslint.org/docs/rules/prefer-template
137 'prefer-template': 'error',
138
139 // require generator functions to contain yield
140 // http://eslint.org/docs/rules/require-yield
141 'require-yield': 'error',
142
143 // enforce spacing between rest and spread operators and their expressions
144 // http://eslint.org/docs/rules/rest-spread-spacing
145 // This is handled by Prettier in Defaults 2.0
146 'rest-spread-spacing': 'off',
147
148 // enforce sorted import declarations within modules
149 // http://eslint.org/docs/rules/sort-imports
150 'sort-imports': ['off', {
151 ignoreCase: false,
152 ignoreMemberSort: false,
153 memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
154 }],
155
156 // require symbol descriptions
157 // http://eslint.org/docs/rules/symbol-description
158 'symbol-description': 'error',
159
160 // require or disallow spacing around embedded expressions of template strings
161 // http://eslint.org/docs/rules/template-curly-spacing
162 // This is handled by Prettier in Defaults 2.0
163 'template-curly-spacing': 'off',
164
165 // require or disallow spacing around the * in yield* expressions
166 // http://eslint.org/docs/rules/yield-star-spacing
167 // This is handled by Prettier in Defaults 2.0
168 'yield-star-spacing': 'off',
169 },
170};