Skip to content

Commit 4b099d8

Browse files
chore: migrate to eslint-config-webpack (#189)
1 parent 7020413 commit 4b099d8

32 files changed

+3404
-994
lines changed

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ indent_size = 2
1414

1515
[*.md]
1616
trim_trailing_whitespace = false
17+
18+
[*.snap]
19+
trim_trailing_whitespace = false

.eslintrc

Lines changed: 0 additions & 18 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ jobs:
4848
cache: yarn
4949
- name: Install dependencies
5050
run: yarn --frozen-lockfile --ignore-engines
51+
if: matrix.node-version == '6.x' || matrix.node-version == '8.x' || matrix.node-version == '10.x' || matrix.node-version == '12.x' || matrix.node-version == '14.x' || matrix.node-version == '16.x'
52+
- name: Install dependencies
53+
run: yarn --frozen-lockfile
54+
if: matrix.node-version != '6.x' && matrix.node-version != '8.x' && matrix.node-version != '10.x' && matrix.node-version != '12.x' && matrix.node-version != '14.x' && matrix.node-version != '16.x'
5155
- name: Run tests with coverage
5256
run: yarn test --ci --coverage
5357
- uses: codecov/codecov-action@v5

.prettierrc.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
"use strict";
2+
13
module.exports = {
24
printWidth: 80,
35
useTabs: true,
46
tabWidth: 2,
57
trailingComma: "none",
8+
arrowParens: "always",
69
overrides: [
710
{
811
files: "*.json",

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ For sync hooks, `tap` is the only valid method to add a plugin. Async hooks also
7070
```js
7171
myCar.hooks.calculateRoutes.tapPromise(
7272
"GoogleMapsPlugin",
73-
(source, target, routesList) => {
73+
(source, target, routesList) =>
7474
// return a promise
75-
return google.maps.findRoute(source, target).then((route) => {
75+
google.maps.findRoute(source, target).then((route) => {
7676
routesList.add(route);
77-
});
78-
}
77+
})
78+
7979
);
8080
myCar.hooks.calculateRoutes.tapAsync(
8181
"BingMapsPlugin",
@@ -106,7 +106,7 @@ class Car {
106106
/**
107107
* You won't get returned value from SyncHook or AsyncParallelHook,
108108
* to do that, use SyncWaterfallHook and AsyncSeriesWaterfallHook respectively
109-
**/
109+
*/
110110

111111
setSpeed(newSpeed) {
112112
// following call returns undefined even when you returned values
@@ -117,10 +117,10 @@ class Car {
117117
const routesList = new List();
118118
return this.hooks.calculateRoutes
119119
.promise(source, target, routesList)
120-
.then((res) => {
120+
.then((res) =>
121121
// res is undefined for AsyncParallelHook
122-
return routesList.getRoutes();
123-
});
122+
routesList.getRoutes()
123+
);
124124
}
125125

126126
useNavigationSystemAsync(source, target, callback) {

eslint.config.mjs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { defineConfig } from "eslint/config";
2+
import config from "eslint-config-webpack";
3+
4+
export default defineConfig([
5+
{
6+
extends: [config],
7+
rules: {
8+
"no-new-func": "off",
9+
"n/prefer-node-protocol": "off"
10+
}
11+
},
12+
{
13+
languageOptions: {
14+
parserOptions: {
15+
ecmaVersion: 2018
16+
}
17+
},
18+
files: ["lib/__tests__/**/*.js"]
19+
}
20+
]);

lib/AsyncParallelBailHook.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class AsyncParallelBailHookCodeFactory extends HookCodeFactory {
4949
code += "}\n";
5050
return code;
5151
},
52-
onTap: (i, run, done, doneBreak) => {
52+
onTap: (i, run, done, _doneBreak) => {
5353
let code = "";
5454
if (i > 0) {
5555
code += `if(${i} >= _results.length) {\n`;
@@ -68,10 +68,10 @@ class AsyncParallelBailHookCodeFactory extends HookCodeFactory {
6868

6969
const factory = new AsyncParallelBailHookCodeFactory();
7070

71-
const COMPILE = function (options) {
71+
function COMPILE(options) {
7272
factory.setup(this, options);
7373
return factory.create(options);
74-
};
74+
}
7575

7676
function AsyncParallelBailHook(args = [], name = undefined) {
7777
const hook = new Hook(args, name);

lib/AsyncParallelHook.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ class AsyncParallelHookCodeFactory extends HookCodeFactory {
1818

1919
const factory = new AsyncParallelHookCodeFactory();
2020

21-
const COMPILE = function (options) {
21+
function COMPILE(options) {
2222
factory.setup(this, options);
2323
return factory.create(options);
24-
};
24+
}
2525

2626
function AsyncParallelHook(args = [], name = undefined) {
2727
const hook = new Hook(args, name);

lib/AsyncSeriesBailHook.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ class AsyncSeriesBailHookCodeFactory extends HookCodeFactory {
2323

2424
const factory = new AsyncSeriesBailHookCodeFactory();
2525

26-
const COMPILE = function (options) {
26+
function COMPILE(options) {
2727
factory.setup(this, options);
2828
return factory.create(options);
29-
};
29+
}
3030

3131
function AsyncSeriesBailHook(args = [], name = undefined) {
3232
const hook = new Hook(args, name);

lib/AsyncSeriesHook.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ class AsyncSeriesHookCodeFactory extends HookCodeFactory {
1818

1919
const factory = new AsyncSeriesHookCodeFactory();
2020

21-
const COMPILE = function (options) {
21+
function COMPILE(options) {
2222
factory.setup(this, options);
2323
return factory.create(options);
24-
};
24+
}
2525

2626
function AsyncSeriesHook(args = [], name = undefined) {
2727
const hook = new Hook(args, name);

0 commit comments

Comments
 (0)