Skip to content

Commit f6dab79

Browse files
committed
[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`
1 parent 173cba3 commit f6dab79

File tree

5 files changed

+10
-16
lines changed

5 files changed

+10
-16
lines changed

packages/eslint-config-airbnb-base/rules/best-practices.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,7 @@ module.exports = {
176176

177177
// disallow certain object properties
178178
// http://eslint.org/docs/rules/no-restricted-properties
179-
// TODO: enable, semver-major
180-
'no-restricted-properties': ['off', {
179+
'no-restricted-properties': ['error', {
181180
object: 'arguments',
182181
property: 'callee',
183182
message: 'arguments.callee is deprecated,'
@@ -187,10 +186,6 @@ module.exports = {
187186
}, {
188187
property: '__defineSetter__',
189188
message: 'Please use Object.defineProperty instead.',
190-
}, {
191-
object: 'Object',
192-
property: 'assign',
193-
message: 'Please use the object spread operator (...) instead.',
194189
}],
195190

196191
// disallow use of assignment in return statement

packages/eslint-config-airbnb-base/rules/es6.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,7 @@ module.exports = {
109109

110110
// disallow parseInt() in favor of binary, octal, and hexadecimal literals
111111
// http://eslint.org/docs/rules/prefer-numeric-literals
112-
// TODO: enable, semver-major
113-
'prefer-numeric-literals': 'off',
112+
'prefer-numeric-literals': 'error',
114113

115114
// suggest using Reflect methods where applicable
116115
// http://eslint.org/docs/rules/prefer-reflect

packages/eslint-config-airbnb-base/rules/imports.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,10 @@ module.exports = {
107107

108108
// Ensure consistent use of file extension within the import path
109109
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/extensions.md
110-
// TODO: enable when https://github.com/benmosher/eslint-plugin-import/issues/390 is resolved
111-
'import/extensions': ['off', 'never'],
110+
'import/extensions': ['error', 'always', {
111+
js: 'never',
112+
jsx: 'never',
113+
}],
112114

113115
// Enforce a convention in module import order
114116
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/order.md
@@ -136,13 +138,11 @@ module.exports = {
136138

137139
// Forbid import of modules using absolute paths
138140
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-absolute-path.md
139-
// TODO: enable, semver-major
140-
'import/no-absolute-path': ['off'],
141+
'import/no-absolute-path': 'error',
141142

142143
// Forbid require() calls with expressions
143144
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-dynamic-require.md
144-
// TODO: enable, semver-major
145-
'import/no-dynamic-require': ['off'],
145+
'import/no-dynamic-require': 'error',
146146

147147
// prevent importing the submodules of other modules
148148
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-internal-modules.md

packages/eslint-config-airbnb-base/rules/style.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,7 @@ module.exports = {
9191

9292
// require or disallow newlines around directives
9393
// http://eslint.org/docs/rules/lines-around-directive
94-
// TODO: enable, semver-major
95-
'lines-around-directive': ['off', {
94+
'lines-around-directive': ['error', {
9695
before: 'always',
9796
after: 'always',
9897
}],

packages/eslint-config-airbnb-base/test/test-base.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import index from '../';
77
const files = { ...{ index } }; // object spread is to test parsing
88

99
fs.readdirSync(path.join(__dirname, '../rules')).forEach((name) => {
10+
// eslint-disable-next-line import/no-dynamic-require
1011
files[name] = require(`../rules/${name}`); // eslint-disable-line global-require
1112
});
1213

0 commit comments

Comments
 (0)