mirror of
https://github.com/airbnb/javascript.git
synced 2026-01-14 04:38:00 -05:00
[eslint config] [base] [breaking] enable rules:
- `no-restricted-properties` - `prefer-numeric-literals` - `lines-around-directive` - `import/extensions` - `import/no-absolute-path` - `import/no-dynamic-require`
This commit is contained in:
@@ -176,8 +176,7 @@ module.exports = {
|
||||
|
||||
// disallow certain object properties
|
||||
// http://eslint.org/docs/rules/no-restricted-properties
|
||||
// TODO: enable, semver-major
|
||||
'no-restricted-properties': ['off', {
|
||||
'no-restricted-properties': ['error', {
|
||||
object: 'arguments',
|
||||
property: 'callee',
|
||||
message: 'arguments.callee is deprecated,'
|
||||
@@ -187,10 +186,6 @@ module.exports = {
|
||||
}, {
|
||||
property: '__defineSetter__',
|
||||
message: 'Please use Object.defineProperty instead.',
|
||||
}, {
|
||||
object: 'Object',
|
||||
property: 'assign',
|
||||
message: 'Please use the object spread operator (...) instead.',
|
||||
}],
|
||||
|
||||
// disallow use of assignment in return statement
|
||||
|
||||
@@ -109,8 +109,7 @@ module.exports = {
|
||||
|
||||
// disallow parseInt() in favor of binary, octal, and hexadecimal literals
|
||||
// http://eslint.org/docs/rules/prefer-numeric-literals
|
||||
// TODO: enable, semver-major
|
||||
'prefer-numeric-literals': 'off',
|
||||
'prefer-numeric-literals': 'error',
|
||||
|
||||
// suggest using Reflect methods where applicable
|
||||
// http://eslint.org/docs/rules/prefer-reflect
|
||||
|
||||
@@ -107,8 +107,10 @@ module.exports = {
|
||||
|
||||
// Ensure consistent use of file extension within the import path
|
||||
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/extensions.md
|
||||
// TODO: enable when https://github.com/benmosher/eslint-plugin-import/issues/390 is resolved
|
||||
'import/extensions': ['off', 'never'],
|
||||
'import/extensions': ['error', 'always', {
|
||||
js: 'never',
|
||||
jsx: 'never',
|
||||
}],
|
||||
|
||||
// Enforce a convention in module import order
|
||||
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/order.md
|
||||
@@ -136,13 +138,11 @@ module.exports = {
|
||||
|
||||
// Forbid import of modules using absolute paths
|
||||
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-absolute-path.md
|
||||
// TODO: enable, semver-major
|
||||
'import/no-absolute-path': ['off'],
|
||||
'import/no-absolute-path': 'error',
|
||||
|
||||
// Forbid require() calls with expressions
|
||||
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-dynamic-require.md
|
||||
// TODO: enable, semver-major
|
||||
'import/no-dynamic-require': ['off'],
|
||||
'import/no-dynamic-require': 'error',
|
||||
|
||||
// prevent importing the submodules of other modules
|
||||
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-internal-modules.md
|
||||
|
||||
@@ -91,8 +91,7 @@ module.exports = {
|
||||
|
||||
// require or disallow newlines around directives
|
||||
// http://eslint.org/docs/rules/lines-around-directive
|
||||
// TODO: enable, semver-major
|
||||
'lines-around-directive': ['off', {
|
||||
'lines-around-directive': ['error', {
|
||||
before: 'always',
|
||||
after: 'always',
|
||||
}],
|
||||
|
||||
@@ -7,6 +7,7 @@ import index from '../';
|
||||
const files = { ...{ index } }; // object spread is to test parsing
|
||||
|
||||
fs.readdirSync(path.join(__dirname, '../rules')).forEach((name) => {
|
||||
// eslint-disable-next-line import/no-dynamic-require
|
||||
files[name] = require(`../rules/${name}`); // eslint-disable-line global-require
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user