Skip to content

Commit

Permalink
chore: updated conf and linting, fixed tests, bump deps
Browse files Browse the repository at this point in the history
  • Loading branch information
titanism committed Jun 6, 2022
1 parent 3dc6cee commit 5128946
Show file tree
Hide file tree
Showing 20 changed files with 131 additions and 8,312 deletions.
4 changes: 2 additions & 2 deletions .commitlintrc.json → .commitlintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
module.exports = {
"extends": [
"@commitlint/config-conventional"
]
}
}
13 changes: 2 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
- 12
- 14
- 16
- 18

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

Expand All @@ -26,15 +27,5 @@ jobs:
with:
node-version: ${{ matrix.node_version }}

- name: Install yarn
run: npm install -g yarn

- name: Install dependencies
run: yarn --frozen-lockfile

- name: Run tests
run: yarn test-coverage

- name: Uninstall yarn
if: always()
run: npm uninstall -g yarn
run: npm run test-coverage
2 changes: 1 addition & 1 deletion .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn commitlint --edit $1
npx --no-install commitlint --edit $1
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn lint-staged
npx --no-install lint-staged && npm test
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
12 changes: 0 additions & 12 deletions .nycrc

This file was deleted.

4 changes: 2 additions & 2 deletions .prettierrc → .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
module.exports = {
"singleQuote": true,
"bracketSpacing": true,
"trailingComma": "none"
}
}
5 changes: 0 additions & 5 deletions .remarkrc

This file was deleted.

3 changes: 3 additions & 0 deletions .remarkrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
plugins: ['preset-github']
};
41 changes: 41 additions & 0 deletions .xo-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
module.exports = {
prettier: true,
space: true,
extends: ['xo-lass'],
ignore: ['config.js'],
rules: {
'capitalized-comments': 'off',
'unicorn/catch-error-name': 'off',
'unicorn/require-post-message-target-origin': 'off',
'node/no-unsupported-features/node-builtins': [
'error',
{
ignores: ['events.once']
}
]
},
overrides: [
{
files: 'test/jobs/*.js',
rules: {
'unicorn/no-process-exit': 'off'
}
},
{
files: [ '*.ts', '**/*.ts' ],
parserOptions: {
project: 'types/tsconfig.json'
},
rules: {
'no-redeclare': 'warn',
'no-unused-vars': 'warn',
'@typescript-eslint/no-unsafe-assignment': 'warn',
'@typescript-eslint/no-unsafe-assignment': 'warn',
'@typescript-eslint/no-unsafe-call': 'warn',
'@typescript-eslint/no-unused-vars': 'warn',
'@typescript-eslint/no-empty-function': 'warn'
}
}
],
parser: '@typescript-eslint/parser'
};
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
</h1>
<div align="center">
<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>
<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>
<a href="https://github.com/sindresorhus/xo"><img src="https://img.shields.io/badge/code_style-XO-5ed9c7.svg" alt="code style" /></a>
<a href="https://github.com/prettier/prettier"><img src="https://img.shields.io/badge/styled_with-prettier-ff69b4.svg" alt="styled with prettier" /></a>
<a href="https://lass.js.org"><img src="https://img.shields.io/badge/made_with-lass-95CC28.svg" alt="made with lass" /></a>
Expand Down
5 changes: 5 additions & 0 deletions ava.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
files: ['test/*.js', 'test/**/*.js', '!test/jobs', '!test/noIndexJobs'],
verbose: true,
require: ['events.once/polyfill']
};
10 changes: 10 additions & 0 deletions nyc.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
extension: ['.js'],
'report-dir': './coverage',
'temp-dir': './.nyc_output',
reporter: ['lcov', 'html', 'text'],
'check-coverage': true,
lines: 100,
functions: 100,
branches: 100
};
115 changes: 24 additions & 91 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,6 @@
"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.",
"version": "8.0.3",
"author": "Nick Baugh <niftylettuce@gmail.com> (http://niftylettuce.com/)",
"ava": {
"files": [
"test/*.js",
"test/**/*.js",
"!test/jobs",
"!test/noIndexJobs"
],
"verbose": true,
"require": [
"events.once/polyfill"
]
},
"bugs": {
"url": "https://github.com/breejs/bree/issues",
"email": "niftylettuce@gmail.com"
Expand All @@ -25,10 +13,10 @@
],
"dependencies": {
"@breejs/later": "^4.1.0",
"boolean": "^3.1.4",
"boolean": "^3.2.0",
"combine-errors": "^3.0.3",
"cron-validate": "^1.4.3",
"debug": "^4.3.3",
"debug": "^4.3.4",
"human-interval": "^2.0.1",
"is-string-and-not-blank": "^0.0.2",
"is-valid-path": "^0.1.1",
Expand All @@ -37,31 +25,32 @@
"safe-timers": "^1.1.0"
},
"devDependencies": {
"@commitlint/cli": "latest",
"@commitlint/config-conventional": "latest",
"@commitlint/cli": "^17.0.2",
"@commitlint/config-conventional": "^17.0.2",
"@goto-bus-stop/envify": "^5.0.0",
"@sinonjs/fake-timers": "^8.1.0",
"@types/node": "^14.0.0",
"@sinonjs/fake-timers": "^9.1.2",
"@types/node": "^17.0.40",
"@types/safe-timers": "^1.1.0",
"ava": "latest",
"codecov": "latest",
"cross-env": "latest",
"@typescript-eslint/eslint-plugin": "^5.27.0",
"@typescript-eslint/parser": "^5.27.0",
"ava": "^4.3.0",
"cross-env": "^7.0.3",
"delay": "^5.0.0",
"dtslint": "^4.2.1",
"eslint": "^8.5.0",
"eslint-config-xo-lass": "latest",
"eslint-plugin-compat": "^4.0.0",
"eslint": "^8.17.0",
"eslint-config-xo-lass": "^2.0.1",
"eslint-plugin-compat": "^4.0.2",
"eslint-plugin-node": "^11.1.0",
"events.once": "^2.0.2",
"fixpack": "latest",
"husky": "^7.0.4",
"husky": "^8.0.1",
"into-stream": "^7.0.0",
"lint-staged": "latest",
"nyc": "latest",
"remark-cli": "latest",
"remark-preset-github": "latest",
"lint-staged": "^13.0.0",
"nyc": "^15.1.0",
"remark-cli": "^10.0.1",
"remark-preset-github": "^4.0.4",
"unassertify": "^2.1.1",
"xo": "^0.47.0"
"xo": "^0.49.0"
},
"engines": {
"node": ">= 12.11.0"
Expand Down Expand Up @@ -163,71 +152,15 @@
},
"scripts": {
"ava": "cross-env NODE_ENV=test ava",
"coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov",
"dtslint": "cross-env NODE_ENV=test dtslint types",
"lint": "yarn run lint:js && yarn run lint:md",
"lint": "npm run lint:js && npm run lint:md",
"lint:js": "xo --ignore examples/",
"lint:md": "remark . -qfo",
"nyc": "cross-env NODE_ENV=test nyc ava",
"prepare": "husky install",
"pretest": "yarn run lint",
"test": "yarn run ava && yarn run dtslint",
"test-coverage": "cross-env NODE_ENV=test nyc yarn run test"
"pretest": "npm run lint",
"test": "npm run ava && npm run dtslint",
"test-coverage": "cross-env NODE_ENV=test nyc npm run test"
},
"types": "types",
"xo": {
"prettier": true,
"space": true,
"extends": [
"xo-lass"
],
"ignore": [
"config.js"
],
"rules": {
"capitalized-comments": "off",
"unicorn/catch-error-name": "off",
"unicorn/require-post-message-target-origin": "off",
"node/no-unsupported-features/node-builtins": [
"error",
{
"ignores": [
"events.once"
]
}
]
},
"overrides": [
{
"files": [
"test/jobs/*.js"
],
"rules": {
"unicorn/no-process-exit": "off"
}
},
{
"files": [
"*.ts"
],
"parserOptions": {
"project": [
"types/tsconfig.json"
]
}
},
{
"files": [
"types/tests.ts"
],
"rules": {
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-call": "off"
}
}
],
"parser": "@typescript-eslint/parser"
}
"types": "types"
}
6 changes: 3 additions & 3 deletions test/get-worker-metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ test('returns meta if output set to true', (t) => {

test('returns meta and worker data if running', async (t) => {
const logger = {
info: () => {}
info() {}
};

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

const logger = {
info: (...args) => {
info(...args) {
if (!args[1] || !args[1].message) {
return;
}

t.is(args[1].message.test, 'test');
},
error: () => {}
error() {}
};

const bree = new Bree({
Expand Down
18 changes: 9 additions & 9 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ test('successfully run job', async (t) => {
t.plan(2);

const logger = {
info: () => {}
info() {}
};

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

const logger = {
info: () => {},
error: (err) => {
info() {},
error(err) {
t.is(err.code, 'MODULE_NOT_FOUND');
}
};
Expand All @@ -101,8 +101,8 @@ test('logs MODULE_NOT_FOUND error if array is empty', (t) => {
t.plan(2);

const logger = {
info: () => {},
error: (err) => {
info() {},
error(err) {
t.is(err.code, 'MODULE_NOT_FOUND');
}
};
Expand All @@ -119,8 +119,8 @@ test('logs MODULE_NOT_FOUND error if array is empty', (t) => {

test('does not log MODULE_NOT_FOUND error if silenceRootCheckError is false', (t) => {
const logger = {
info: () => {},
error: () => {
info() {},
error() {
t.fail();
}
};
Expand All @@ -138,8 +138,8 @@ test('does not log MODULE_NOT_FOUND error if silenceRootCheckError is false', (t

test('does not log MODULE_NOT_FOUND error if doRootCheck is false', (t) => {
const logger = {
info: () => {},
error: () => {
info() {},
error() {
t.fail();
}
};
Expand Down
Loading

0 comments on commit 5128946

Please sign in to comment.