@tensor-corp/eslint-config
Advanced tools
Comparing version 2.0.4 to 2.0.5
86
base.js
'use strict'; | ||
const restrictedGlobals = require('eslint-restricted-globals'); | ||
const es6Rules = require('./impl/es6-rules'); | ||
@@ -8,3 +9,4 @@ // конфигурация, которая применима к любому JS коду в компании: код es5, es6+, node.js | ||
parserOptions: { | ||
ecmaVersion: 9 | ||
ecmaVersion: 9, | ||
sourceType: 'script' | ||
}, | ||
@@ -380,11 +382,15 @@ env: { | ||
], | ||
'spaced-comment': ['warn', 'always', { | ||
line: { | ||
exceptions: ['-', '+'] | ||
}, | ||
block: { | ||
exceptions: ['-', '+'], | ||
balanced: true, | ||
'spaced-comment': [ | ||
'warn', | ||
'always', | ||
{ | ||
line: { | ||
exceptions: ['-', '+'] | ||
}, | ||
block: { | ||
exceptions: ['-', '+'], | ||
balanced: true | ||
} | ||
} | ||
}], | ||
], | ||
'switch-colon-spacing': ['warn', { after: true, before: false }], | ||
@@ -399,8 +405,16 @@ 'template-tag-spacing': ['warn', 'never'], | ||
// задаются в конфигурации ./es6.js | ||
'arrow-body-style': ['warn', 'as-needed', { | ||
requireReturnForObjectLiteral: false, | ||
}], | ||
'arrow-parens': ['warn', 'as-needed', { | ||
requireForBlockBody: true, | ||
}], | ||
'arrow-body-style': [ | ||
'warn', | ||
'as-needed', | ||
{ | ||
requireReturnForObjectLiteral: false | ||
} | ||
], | ||
'arrow-parens': [ | ||
'warn', | ||
'as-needed', | ||
{ | ||
requireForBlockBody: true | ||
} | ||
], | ||
'arrow-spacing': ['warn', { before: true, after: true }], | ||
@@ -410,5 +424,8 @@ 'constructor-super': 'error', | ||
'no-class-assign': 'error', | ||
'no-confusing-arrow': ['warn', { | ||
allowParens: true, | ||
}], | ||
'no-confusing-arrow': [ | ||
'warn', | ||
{ | ||
allowParens: true | ||
} | ||
], | ||
'no-const-assign': 'error', | ||
@@ -422,7 +439,10 @@ 'no-dupe-class-members': 'error', | ||
'no-useless-constructor': 'warn', | ||
'no-useless-rename': ['warn', { | ||
ignoreDestructuring: false, | ||
ignoreImport: false, | ||
ignoreExport: false, | ||
}], | ||
'no-useless-rename': [ | ||
'warn', | ||
{ | ||
ignoreDestructuring: false, | ||
ignoreImport: false, | ||
ignoreExport: false | ||
} | ||
], | ||
'no-var': 'off', | ||
@@ -444,8 +464,18 @@ 'object-shorthand': 'off', | ||
}, | ||
'overrides': { | ||
'files': ['**/*.test.js', '**/*.case.js'], | ||
'rules': { | ||
'max-nested-callbacks': 'off' | ||
overrides: [ | ||
{ | ||
files: ['**/*.test.js', '**/*.case.js'], | ||
rules: { | ||
'max-nested-callbacks': 'off' | ||
} | ||
}, | ||
{ | ||
files: ['**/*.es'], | ||
parserOptions: { | ||
ecmaVersion: 9, | ||
sourceType: 'module' | ||
}, | ||
rules: es6Rules | ||
} | ||
} | ||
] | ||
}; |
@@ -0,1 +1,6 @@ | ||
2.0.5 | ||
================== | ||
- В конфиге base добавил обработку *.es файлов для простого внедрения ES6. | ||
- Добавил опцию parserOptions.sourceType в конфиги для корректной работы ESLint. | ||
2.0.4 | ||
@@ -2,0 +7,0 @@ ================== |
98
es6.js
'use strict'; | ||
const es6Rules = require('./impl/es6-rules'); | ||
// конфигурация, которая заставляет использовать новый синтаксис ES6+ | ||
module.exports = { | ||
extends: './base.js', | ||
rules: { | ||
'no-restricted-properties': ['warn', | ||
{ | ||
object: 'arguments', | ||
property: 'callee', | ||
message: 'arguments.callee is deprecated', | ||
}, | ||
{ | ||
object: 'global', | ||
property: 'isFinite', | ||
message: 'Please use Number.isFinite instead', | ||
}, | ||
{ | ||
object: 'self', | ||
property: 'isFinite', | ||
message: 'Please use Number.isFinite instead', | ||
}, | ||
{ | ||
object: 'window', | ||
property: 'isFinite', | ||
message: 'Please use Number.isFinite instead', | ||
}, | ||
{ | ||
object: 'global', | ||
property: 'isNaN', | ||
message: 'Please use Number.isNaN instead', | ||
}, | ||
{ | ||
object: 'self', | ||
property: 'isNaN', | ||
message: 'Please use Number.isNaN instead', | ||
}, | ||
{ | ||
object: 'window', | ||
property: 'isNaN', | ||
message: 'Please use Number.isNaN instead', | ||
}, | ||
{ | ||
property: '__defineGetter__', | ||
message: 'Please use Object.defineProperty instead.', | ||
}, | ||
{ | ||
property: '__defineSetter__', | ||
message: 'Please use Object.defineProperty instead.', | ||
}, | ||
{ | ||
object: 'Math', | ||
property: 'pow', | ||
message: 'Use the exponentiation operator (**) instead.', | ||
}], | ||
'no-var': 'warn', | ||
'object-shorthand': ['warn', 'always', { | ||
ignoreConstructors: false, | ||
avoidQuotes: true, | ||
}], | ||
'prefer-arrow-callback': ['warn', { | ||
allowNamedFunctions: true, | ||
allowUnboundThis: true, | ||
}], | ||
'prefer-const': ['warn', { | ||
destructuring: 'any', | ||
ignoreReadBeforeAssign: true, | ||
}], | ||
'prefer-destructuring': ['warn', { | ||
VariableDeclarator: { | ||
array: false, | ||
object: true, | ||
}, | ||
AssignmentExpression: { | ||
array: true, | ||
object: true, | ||
}, | ||
}, { | ||
enforceForRenamedProperties: false, | ||
}], | ||
'prefer-numeric-literals': 'warn', | ||
'prefer-rest-params': 'warn', | ||
'prefer-spread': 'warn', | ||
'prefer-template': 'warn', | ||
'prefer-object-spread': 'warn', | ||
'comma-dangle': [ | ||
'warn', | ||
{ | ||
arrays: 'only-multiline', | ||
objects: 'only-multiline', | ||
imports: 'only-multiline', | ||
exports: 'only-multiline', | ||
functions: 'only-multiline' | ||
} | ||
] | ||
} | ||
parserOptions: { | ||
ecmaVersion: 9, | ||
sourceType: 'module' | ||
}, | ||
rules: es6Rules | ||
}; |
@@ -6,2 +6,6 @@ 'use strict'; | ||
extends: './es6.js', | ||
parserOptions: { | ||
ecmaVersion: 9, | ||
sourceType: 'script' | ||
}, | ||
env: { | ||
@@ -8,0 +12,0 @@ browser: false, |
{ | ||
"name": "@tensor-corp/eslint-config", | ||
"version": "2.0.4", | ||
"version": "2.0.5", | ||
"description": "Tensor company's ESLint config, following our styleguide", | ||
@@ -5,0 +5,0 @@ "author": "Aleksey Begunov (https://twitter.com/@catwithapple)", |
20832
519