Skip to content

Commit 351b73b

Browse files
committed
feat: enable new rules(no-import-assign, default-param-last, prefer-regex-literals)
BREAKING CHANGE: enable no-import-assign, default-param-last, prefer-regex-literals rules
1 parent be1001a commit 351b73b

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

lib/base.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ module.exports = {
1616
// =======
1717

1818
// Best Practices
19+
"default-param-last": "error",
1920
"no-caller": "error",
2021
"no-eval": "error",
2122
"no-extend-native": "error",
@@ -43,6 +44,7 @@ module.exports = {
4344
"no-useless-concat": "error",
4445
"no-void": "error",
4546
"no-with": "error",
47+
"prefer-regex-literals": "error",
4648
radix: "error",
4749
"wrap-iife": ["error", "any"],
4850
// no-case-declarations
@@ -57,6 +59,7 @@ module.exports = {
5759
// Possible Errors
5860
"no-async-promise-executor": "error",
5961
"no-extra-parens": ["error", "functions"],
62+
"no-import-assign": "error",
6063
"require-atomic-updates": "error",
6164
"valid-typeof": [
6265
"error",

test/base-test.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@ describe("base", () => {
1313
"no-redeclare",
1414
"getter-return",
1515
"no-self-assign",
16+
"no-import-assign",
1617
"require-atomic-updates",
17-
"no-async-promise-executor"
18+
"no-async-promise-executor",
19+
"default-param-last",
20+
"prefer-regex-literals"
1821
],
1922
warnings: ["no-useless-return"]
2023
},

test/fixtures/base/error.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import mod from './mod';
2+
13
var foo = {};
24
var foo = {};
35
const obj = {
@@ -9,6 +11,18 @@ const obj = {
911

1012
obj.a = obj.a;
1113

14+
mod = 'mod';
15+
console.log(mod);
16+
1217
(async () => {
1318
obj.a += await new Promise(async (r) => r(10));
14-
})();
19+
})();
20+
21+
function fn(a, b = 'b', c) {
22+
// noop
23+
}
24+
fn();
25+
26+
const regexp = new RegExp('foo|bar');
27+
console.log(regexp);
28+

0 commit comments

Comments
 (0)