Skip to content

Commit 5128946

Browse files
committed
chore: updated conf and linting, fixed tests, bump deps
1 parent 3dc6cee commit 5128946

20 files changed

+131
-8312
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
{
1+
module.exports = {
22
"extends": [
33
"@commitlint/config-conventional"
44
]
5-
}
5+
}

.github/workflows/ci.yml

+2-11
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ jobs:
1414
- 12
1515
- 14
1616
- 16
17+
- 18
1718

1819
name: Node ${{ matrix.node_version }} on ${{ matrix.os }}
1920

@@ -26,15 +27,5 @@ jobs:
2627
with:
2728
node-version: ${{ matrix.node_version }}
2829

29-
- name: Install yarn
30-
run: npm install -g yarn
31-
32-
- name: Install dependencies
33-
run: yarn --frozen-lockfile
34-
3530
- name: Run tests
36-
run: yarn test-coverage
37-
38-
- name: Uninstall yarn
39-
if: always()
40-
run: npm uninstall -g yarn
31+
run: npm run test-coverage

.husky/commit-msg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/sh
22
. "$(dirname "$0")/_/husky.sh"
33

4-
yarn commitlint --edit $1
4+
npx --no-install commitlint --edit $1

.husky/pre-commit

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/sh
22
. "$(dirname "$0")/_/husky.sh"
33

4-
yarn lint-staged
4+
npx --no-install lint-staged && npm test

.npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock=false

.nycrc

-12
This file was deleted.
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
{
1+
module.exports = {
22
"singleQuote": true,
33
"bracketSpacing": true,
44
"trailingComma": "none"
5-
}
5+
}

.remarkrc

-5
This file was deleted.

.remarkrc.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
plugins: ['preset-github']
3+
};

.xo-config.js

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
module.exports = {
2+
prettier: true,
3+
space: true,
4+
extends: ['xo-lass'],
5+
ignore: ['config.js'],
6+
rules: {
7+
'capitalized-comments': 'off',
8+
'unicorn/catch-error-name': 'off',
9+
'unicorn/require-post-message-target-origin': 'off',
10+
'node/no-unsupported-features/node-builtins': [
11+
'error',
12+
{
13+
ignores: ['events.once']
14+
}
15+
]
16+
},
17+
overrides: [
18+
{
19+
files: 'test/jobs/*.js',
20+
rules: {
21+
'unicorn/no-process-exit': 'off'
22+
}
23+
},
24+
{
25+
files: [ '*.ts', '**/*.ts' ],
26+
parserOptions: {
27+
project: 'types/tsconfig.json'
28+
},
29+
rules: {
30+
'no-redeclare': 'warn',
31+
'no-unused-vars': 'warn',
32+
'@typescript-eslint/no-unsafe-assignment': 'warn',
33+
'@typescript-eslint/no-unsafe-assignment': 'warn',
34+
'@typescript-eslint/no-unsafe-call': 'warn',
35+
'@typescript-eslint/no-unused-vars': 'warn',
36+
'@typescript-eslint/no-empty-function': 'warn'
37+
}
38+
}
39+
],
40+
parser: '@typescript-eslint/parser'
41+
};

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
</h1>
44
<div align="center">
55
<a href="https://github.com/breejs/bree/actions/workflows/ci.yml"><img src="https://github.com/breejs/later/actions/workflows/ci.yml/badge.svg" alt="build status" /></a>
6-
<a href="https://codecov.io/github/breejs/bree"><img src="https://img.shields.io/codecov/c/github/breejs/bree/master.svg" alt="code coverage" /></a>
76
<a href="https://github.com/sindresorhus/xo"><img src="https://img.shields.io/badge/code_style-XO-5ed9c7.svg" alt="code style" /></a>
87
<a href="https://github.com/prettier/prettier"><img src="https://img.shields.io/badge/styled_with-prettier-ff69b4.svg" alt="styled with prettier" /></a>
98
<a href="https://lass.js.org"><img src="https://img.shields.io/badge/made_with-lass-95CC28.svg" alt="made with lass" /></a>

ava.config.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
files: ['test/*.js', 'test/**/*.js', '!test/jobs', '!test/noIndexJobs'],
3+
verbose: true,
4+
require: ['events.once/polyfill']
5+
};

nyc.config.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module.exports = {
2+
extension: ['.js'],
3+
'report-dir': './coverage',
4+
'temp-dir': './.nyc_output',
5+
reporter: ['lcov', 'html', 'text'],
6+
'check-coverage': true,
7+
lines: 100,
8+
functions: 100,
9+
branches: 100
10+
};

package.json

+24-91
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,6 @@
33
"description": "The best job scheduler for Node.js and JavaScript with cron, dates, ms, later, and human-friendly support. Works in Node v12.11.0+, uses worker threads to spawn sandboxed processes, and supports async/await, retries, throttling, concurrency, and cancelable promises (graceful shutdown). Simple, fast, and lightweight. Made for Forward Email and Lad.",
44
"version": "8.0.3",
55
"author": "Nick Baugh <[email protected]> (http://niftylettuce.com/)",
6-
"ava": {
7-
"files": [
8-
"test/*.js",
9-
"test/**/*.js",
10-
"!test/jobs",
11-
"!test/noIndexJobs"
12-
],
13-
"verbose": true,
14-
"require": [
15-
"events.once/polyfill"
16-
]
17-
},
186
"bugs": {
197
"url": "https://github.com/breejs/bree/issues",
208
"email": "[email protected]"
@@ -25,10 +13,10 @@
2513
],
2614
"dependencies": {
2715
"@breejs/later": "^4.1.0",
28-
"boolean": "^3.1.4",
16+
"boolean": "^3.2.0",
2917
"combine-errors": "^3.0.3",
3018
"cron-validate": "^1.4.3",
31-
"debug": "^4.3.3",
19+
"debug": "^4.3.4",
3220
"human-interval": "^2.0.1",
3321
"is-string-and-not-blank": "^0.0.2",
3422
"is-valid-path": "^0.1.1",
@@ -37,31 +25,32 @@
3725
"safe-timers": "^1.1.0"
3826
},
3927
"devDependencies": {
40-
"@commitlint/cli": "latest",
41-
"@commitlint/config-conventional": "latest",
28+
"@commitlint/cli": "^17.0.2",
29+
"@commitlint/config-conventional": "^17.0.2",
4230
"@goto-bus-stop/envify": "^5.0.0",
43-
"@sinonjs/fake-timers": "^8.1.0",
44-
"@types/node": "^14.0.0",
31+
"@sinonjs/fake-timers": "^9.1.2",
32+
"@types/node": "^17.0.40",
4533
"@types/safe-timers": "^1.1.0",
46-
"ava": "latest",
47-
"codecov": "latest",
48-
"cross-env": "latest",
34+
"@typescript-eslint/eslint-plugin": "^5.27.0",
35+
"@typescript-eslint/parser": "^5.27.0",
36+
"ava": "^4.3.0",
37+
"cross-env": "^7.0.3",
4938
"delay": "^5.0.0",
5039
"dtslint": "^4.2.1",
51-
"eslint": "^8.5.0",
52-
"eslint-config-xo-lass": "latest",
53-
"eslint-plugin-compat": "^4.0.0",
40+
"eslint": "^8.17.0",
41+
"eslint-config-xo-lass": "^2.0.1",
42+
"eslint-plugin-compat": "^4.0.2",
5443
"eslint-plugin-node": "^11.1.0",
5544
"events.once": "^2.0.2",
5645
"fixpack": "latest",
57-
"husky": "^7.0.4",
46+
"husky": "^8.0.1",
5847
"into-stream": "^7.0.0",
59-
"lint-staged": "latest",
60-
"nyc": "latest",
61-
"remark-cli": "latest",
62-
"remark-preset-github": "latest",
48+
"lint-staged": "^13.0.0",
49+
"nyc": "^15.1.0",
50+
"remark-cli": "^10.0.1",
51+
"remark-preset-github": "^4.0.4",
6352
"unassertify": "^2.1.1",
64-
"xo": "^0.47.0"
53+
"xo": "^0.49.0"
6554
},
6655
"engines": {
6756
"node": ">= 12.11.0"
@@ -163,71 +152,15 @@
163152
},
164153
"scripts": {
165154
"ava": "cross-env NODE_ENV=test ava",
166-
"coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov",
167155
"dtslint": "cross-env NODE_ENV=test dtslint types",
168-
"lint": "yarn run lint:js && yarn run lint:md",
156+
"lint": "npm run lint:js && npm run lint:md",
169157
"lint:js": "xo --ignore examples/",
170158
"lint:md": "remark . -qfo",
171159
"nyc": "cross-env NODE_ENV=test nyc ava",
172160
"prepare": "husky install",
173-
"pretest": "yarn run lint",
174-
"test": "yarn run ava && yarn run dtslint",
175-
"test-coverage": "cross-env NODE_ENV=test nyc yarn run test"
161+
"pretest": "npm run lint",
162+
"test": "npm run ava && npm run dtslint",
163+
"test-coverage": "cross-env NODE_ENV=test nyc npm run test"
176164
},
177-
"types": "types",
178-
"xo": {
179-
"prettier": true,
180-
"space": true,
181-
"extends": [
182-
"xo-lass"
183-
],
184-
"ignore": [
185-
"config.js"
186-
],
187-
"rules": {
188-
"capitalized-comments": "off",
189-
"unicorn/catch-error-name": "off",
190-
"unicorn/require-post-message-target-origin": "off",
191-
"node/no-unsupported-features/node-builtins": [
192-
"error",
193-
{
194-
"ignores": [
195-
"events.once"
196-
]
197-
}
198-
]
199-
},
200-
"overrides": [
201-
{
202-
"files": [
203-
"test/jobs/*.js"
204-
],
205-
"rules": {
206-
"unicorn/no-process-exit": "off"
207-
}
208-
},
209-
{
210-
"files": [
211-
"*.ts"
212-
],
213-
"parserOptions": {
214-
"project": [
215-
"types/tsconfig.json"
216-
]
217-
}
218-
},
219-
{
220-
"files": [
221-
"types/tests.ts"
222-
],
223-
"rules": {
224-
"@typescript-eslint/no-unused-vars": "off",
225-
"@typescript-eslint/no-empty-function": "off",
226-
"@typescript-eslint/no-unsafe-assignment": "off",
227-
"@typescript-eslint/no-unsafe-call": "off"
228-
}
229-
}
230-
],
231-
"parser": "@typescript-eslint/parser"
232-
}
165+
"types": "types"
233166
}

test/get-worker-metadata.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ test('returns meta if output set to true', (t) => {
6262

6363
test('returns meta and worker data if running', async (t) => {
6464
const logger = {
65-
info: () => {}
65+
info() {}
6666
};
6767

6868
const bree = new Bree({
@@ -86,14 +86,14 @@ test('job with worker data sent by job', async (t) => {
8686
t.plan(1);
8787

8888
const logger = {
89-
info: (...args) => {
89+
info(...args) {
9090
if (!args[1] || !args[1].message) {
9191
return;
9292
}
9393

9494
t.is(args[1].message.test, 'test');
9595
},
96-
error: () => {}
96+
error() {}
9797
};
9898

9999
const bree = new Bree({

test/index.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ test('successfully run job', async (t) => {
2222
t.plan(2);
2323

2424
const logger = {
25-
info: () => {}
25+
info() {}
2626
};
2727

2828
const bree = new Bree({
@@ -77,8 +77,8 @@ test('throws if jobs is not an array and logs MODULE_NOT_FOUND error by default'
7777
t.plan(2);
7878

7979
const logger = {
80-
info: () => {},
81-
error: (err) => {
80+
info() {},
81+
error(err) {
8282
t.is(err.code, 'MODULE_NOT_FOUND');
8383
}
8484
};
@@ -101,8 +101,8 @@ test('logs MODULE_NOT_FOUND error if array is empty', (t) => {
101101
t.plan(2);
102102

103103
const logger = {
104-
info: () => {},
105-
error: (err) => {
104+
info() {},
105+
error(err) {
106106
t.is(err.code, 'MODULE_NOT_FOUND');
107107
}
108108
};
@@ -119,8 +119,8 @@ test('logs MODULE_NOT_FOUND error if array is empty', (t) => {
119119

120120
test('does not log MODULE_NOT_FOUND error if silenceRootCheckError is false', (t) => {
121121
const logger = {
122-
info: () => {},
123-
error: () => {
122+
info() {},
123+
error() {
124124
t.fail();
125125
}
126126
};
@@ -138,8 +138,8 @@ test('does not log MODULE_NOT_FOUND error if silenceRootCheckError is false', (t
138138

139139
test('does not log MODULE_NOT_FOUND error if doRootCheck is false', (t) => {
140140
const logger = {
141-
info: () => {},
142-
error: () => {
141+
info() {},
142+
error() {
143143
t.fail();
144144
}
145145
};

0 commit comments

Comments
 (0)