Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 0 additions & 104 deletions .eslintrc.js

This file was deleted.

2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20
24
13 changes: 3 additions & 10 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

## Installation

1. Install Node.js [`node@20.x` and `npm@10.x` are required]
1. Install Node.js [an [active LTS release](https://nodejs.org/en/about/previous-releases) (`node@22.x` or newer) and `npm@10.x` or newer are required]
2. Clone this repository `$ git clone git@github.com:busticated/jsville.git && cd ./jsville`
3. Install dependencies `$ npm install`
4. View available commands `$ npm run`
Expand Down Expand Up @@ -103,14 +103,7 @@ e.g.
npm test -- --workspace packages/timer
```

To run tests _with_ code coverage reporting:

```shell
npm run test:coverage
```

> [!NOTE]
> 🐛 Node's `--experimental-test-coverage` can throw on some older Node versions when reporting coverage for source-mapped TypeScript builds ([nodejs/node#51552](https://github.com/nodejs/node/issues/51552)) - this will be fixed in a future update.
`npm test` reports code coverage alongside test results and fails if line, branch, or function coverage drops below 100%.

Run `npm run` to see other test-related commands, if available.

Expand Down Expand Up @@ -304,7 +297,7 @@ e.g.

## Docs & Resources

* [Node.js](https://nodejs.org/dist/latest-v20.x/docs/api/)
* [Node.js](https://nodejs.org/dist/latest-v24.x/docs/api/)
* [Typescript](https://www.typescriptlang.org)
* [tshy](https://github.com/isaacs/tshy)
* [NPM](https://docs.npmjs.com)
Expand Down
6 changes: 2 additions & 4 deletions bin/lib/log.mjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
export const log = (message) => {
console.log(message); // eslint-disable-line no-console
console.log(message);
};

export const logTitle = (message) => {
log(`:::: ${message}`); // eslint-disable-line no-console
log(`:::: ${message}`);
};

// https://patorjk.com/software/taag/#p=display&f=Ivrit&t=JSVille
Expand All @@ -20,10 +20,8 @@ export const logBanner = () => {
};

export const logErrorAndExit = (error, code = 1) => {
/* eslint-disable no-console */
console.error(':::: Whoops!');
console.error(error);
return process.exit(code);
/* eslint-enable no-console */
};

2 changes: 1 addition & 1 deletion bin/lib/pkg.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class Pkg {

try {
({ stdout: version } = await execa('npm', ['view', name, 'version']));
} catch (_) {
} catch {
version = '0.0.0';
}

Expand Down
8 changes: 4 additions & 4 deletions bin/templates/package.json.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"license": "(MIT OR Apache-2.0)",
"type": "module",
"main": "./dist/commonjs/index.js",
"module": "./dist/esm/index.js",
"types": "./dist/commonjs/index.d.ts",
"files": [
"CHANGELOG.md",
Expand All @@ -17,8 +18,7 @@
"scripts": {
"version": "npm run changelog:update && npm run docs:build",
"prepare": "npm run build",
"test": "npm run build && node --test --test-reporter spec --enable-source-maps dist/esm/*.test.js",
"test:coverage": "npm run build && NODE_V8_COVERAGE=tmp/coverage node --test --test-reporter spec --experimental-test-coverage --enable-source-maps dist/esm/*.test.js",
"test": "npm run build && node --test --test-reporter spec --experimental-test-coverage --test-coverage-lines=100 --test-coverage-branches=100 --test-coverage-functions=100 --enable-source-maps dist/esm/*.test.js",
"typecheck": "tsc --project .tshy/esm.json --noemit",
"build": "tshy",
"clean": "rm -rf ./dist && rm -rf ./tmp/*",
Expand All @@ -30,7 +30,7 @@
"changelog:update": "node ../../bin/update-changelog.mjs <%= name %>"
},
"engines": {
"node": ">=18",
"npm": "10.x"
"node": ">=22",
"npm": ">=10"
}
}
123 changes: 123 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
import path from 'node:path';
import js from '@eslint/js';
import tseslint from 'typescript-eslint';
import globals from 'globals';
import { includeIgnoreFile } from '@eslint/compat';

export default tseslint.config(
includeIgnoreFile(path.join(import.meta.dirname, '.gitignore')),
{
ignores: ['**/docs/**']
},
js.configs.recommended,
tseslint.configs.recommended,
{
languageOptions: {
ecmaVersion: 2024,
globals: {
...globals['shared-node-browser'],
...globals.commonjs,
process: true
}
},
rules: {
'array-bracket-spacing': ['error', 'never'],
'arrow-spacing': 'error',
'block-scoped-var': 'error',
'block-spacing': 'error',
'brace-style': ['error', '1tbs'],
'camelcase': ['error', {
properties: 'never'
}],
'constructor-super': 'error',
'curly': 'error',
'eol-last': 'error',
'eqeqeq': ['error', 'smart'],
'func-names': ['error', 'as-needed'],
'func-style': ['error', 'declaration', {
allowArrowFunctions: true
}],
'indent': ['error', 'tab', {
SwitchCase: 1,
ObjectExpression: 'first',
MemberExpression: 1,
ignoredNodes: ['TemplateLiteral *']
}],
'keyword-spacing': ['error', {
before: true,
after: true,
}],
'max-depth': ['warn', 3],
'max-len': ['error', {
code: 120,
ignoreComments: true,
ignoreTrailingComments: true,
ignoreUrls: true,
ignoreStrings: true,
ignoreTemplateLiterals: true
}],
'max-statements': ['warn', 30],
'new-cap': 'warn',
'no-class-assign': 'error',
'no-cond-assign': ['error', 'except-parens'],
'no-console': 'error',
'no-const-assign': 'error',
'no-dupe-class-members': 'error',
'no-extend-native': 'error',
'no-extra-parens': ['error', 'functions'],
'no-mixed-spaces-and-tabs': 'error',
'no-multi-spaces': ['error', {
exceptions: {
VariableDeclarator: true,
}
}],
'no-nested-ternary': 'error',
'no-prototype-builtins': 'off',
'no-this-before-super': 'error',
'no-trailing-spaces': 'error',
'no-undef': 'error',
'no-underscore-dangle': 'off',
'no-use-before-define': ['error', {
functions: false,
classes: false
}],
'no-whitespace-before-property': 'error',
'no-var': 'error',
'object-curly-spacing': ['error', 'always'],
'prefer-const': 'error',
'quotes': ['error', 'single', {
avoidEscape: true,
allowTemplateLiterals: true
}],
'semi': ['error', 'always'],
'space-in-parens': ['error', 'never'],
'space-infix-ops': 'error',
'space-unary-ops': ['error', {
words: true,
nonwords: false
}],
'strict': ['error', 'global']
}
},
{
files: [
'**/*.spec.js',
'**/*.test.js',
'**/*.e2e.js',
'**/*.integration.js',
'**/*.spec.ts',
'**/*.test.ts',
'**/*.e2e.ts',
'**/*.integration.ts',
],
rules: {
'func-names': 'off'
}
},
{
files: ['bin/lib/log.mjs'],
rules: {
'no-console': 'off'
}
}
);
Loading