Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node 22, bump dependencies, & ESLint upgrade #139

Merged
merged 8 commits into from
Apr 27, 2024
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
88 changes: 0 additions & 88 deletions .eslintrc.json

This file was deleted.

8 changes: 4 additions & 4 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
persist-credentials: false

- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 21
node-version: 22
cache: 'npm'

- run: npm ci
Expand All @@ -26,7 +26,7 @@ jobs:
run: node bench.js | tee output.txt

- name: Download previous benchmark data
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: ./cache
key: ${{ runner.os }}-benchmark
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
persist-credentials: false

- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 21
node-version: 22
registry-url: 'https://registry.npmjs.org'

- run: npm ci
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ jobs:

strategy:
matrix:
node: [18, 20, 21]
node: [18, 20, 21, 22]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
persist-credentials: false

- name: Setup Node.js ${{ matrix.node }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'npm'
Expand Down
2 changes: 0 additions & 2 deletions bench.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable node/no-unsupported-features/es-syntax */
/* eslint-disable import/no-nodejs-modules */
import Benchmark from 'benchmark';
import * as fs from 'fs';
import chalk from 'chalk';
Expand Down
86 changes: 86 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
// eslint.config.js
// eslint-disable-next-line n/no-extraneous-import
import js from '@eslint/js';
import stylisticJs from '@stylistic/eslint-plugin-js';
import ava from 'eslint-plugin-ava';
//import import from 'eslint-plugin-import';
import node from 'eslint-plugin-n';
import jsdoc from 'eslint-plugin-jsdoc';

export default [
js.configs.recommended,
ava.configs['flat/recommended'],
node.configs['flat/recommended'],
jsdoc.configs['flat/recommended'],
{
plugins: {
'@stylistic/js': stylisticJs,
ava,
//import,
node,
jsdoc
},
rules: {
//
// -- DEFAULT RULES --
//
// Enforce camelCase for variable names
camelcase: ['error', {
properties: 'never'
}],
// Disallow multiple imports of same module
'no-duplicate-imports': 'error',
// Enforce let or const instead of var
'no-var': 'error',
//
// -- STYLISTIC RULES --
//
// Enforce omitting parentheses when unnecessary for arrow functions
'@stylistic/js/arrow-parens': ['error', 'as-needed'],
// Enforce consistent spacing before & after arrow function
'@stylistic/js/arrow-spacing': 'error',
// Enforce consistent brace style usage (1TBS default)
'@stylistic/js/brace-style': 'error',
// Enforce indent of two spaces
'@stylistic/js/indent': [
'error', 2, {
'SwitchCase': 1
}
],
// Remove trailing whitespace
'@stylistic/js/no-trailing-spaces': 'error',
// Enforce use of single quotes
'@stylistic/js/quotes': ['error', 'single'],
// Enforce use of semicolon to end lines
'@stylistic/js/semi': 'error',
//
// -- IMPORT RULES --
//
// Report modules without exports, or exports without matching import in another module
/*'import/no-unused-modules': 'error',
// Report potentially ambiguous parse goal (script vs. module)
'import/unambiguous': 'error',
// Report CommonJS require calls and module.exports or exports.*
'import/no-commonjs': 'error',
// Report AMD require and define calls
'import/no-amd': 'error',
// No Node.js builtin modules
'import/no-nodejs-modules': 'error',
// Report imported names marked with @deprecated documentation tag
'import/no-deprecated': 'error',
// Ensure all imports appear before other statements
'import/first': 'error',
// Ensure consistent use of file extension within the import path
'import/extensions': ['error', 'always'],
// Forbid unassigned imports
'import/no-unassigned-import': ['error'],*/
//
// -- AVA RULES --
//
'ava/no-ignored-test-files': ['error', {
files: [
'test/*'
]
}]
}
}];
6 changes: 3 additions & 3 deletions examples/node.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/* eslint-disable import/no-nodejs-modules */
//// eslint-disable import/no-nodejs-modules
import chalk from 'chalk';
import * as fs from 'fs';
import { stdin as input, stdout as output } from 'node:process';
// eslint-disable-next-line import/no-unresolved, node/no-missing-import
//// eslint-disable-next-line import/no-unresolved
// eslint-disable-next-line n/no-unsupported-features/node-builtins
import * as readline from 'node:readline/promises';

const rl = readline.createInterface({ input, output });
Expand All @@ -12,7 +13,6 @@ const lang = await rl.question('\nLanguage to use?\n');
if (fs.existsSync('./lib/i18n/' + lang + '.js')) {
const value = await rl.question('\nValue to convert?\n');

// eslint-disable-next-line node/no-unsupported-features/es-syntax
const { default: n2words } = await import('../lib/i18n/' + lang + '.js');

const result = n2words(value, {
Expand Down
Loading