Bumped eslint to v9 and ecmaScript to 2025

This commit is contained in:
McToel 2025-02-19 00:25:25 +01:00
parent c951466597
commit 1f95ca06c1
5 changed files with 1576 additions and 1153 deletions

View file

@ -1,54 +0,0 @@
{
"env": {
"es2021": true,
"node": true
},
"extends": ["eslint:recommended", "plugin:@stylistic/all-extends"],
"ignorePatterns": ["node_modules", "*example.js"],
"parserOptions": {
"ecmaVersion": 2021,
"sourceType": "module"
},
"rules": {
"curly": "error",
"no-implicit-coercion": "error",
"no-unused-vars": [
"error",
{
"vars": "all",
"args": "none",
"ignoreRestSiblings": false
}
],
"@stylistic/array-bracket-newline": ["error", "consistent"],
"@stylistic/array-element-newline": ["error", "consistent"],
"@stylistic/arrow-parens": "off",
"@stylistic/comma-dangle": ["error", "always-multiline"],
"@stylistic/dot-location": ["error", "property"],
"@stylistic/function-call-argument-newline": ["error", "consistent"],
"@stylistic/function-paren-newline": "off",
"@stylistic/indent": ["error", "tab"],
"@stylistic/indent-binary-ops": ["error", "tab"],
"@stylistic/max-len": "off",
"@stylistic/multiline-ternary": ["error", "always-multiline"],
"@stylistic/newline-per-chained-call": ["error", { "ignoreChainWithDepth": 1 }],
"@stylistic/no-mixed-operators": "off",
"@stylistic/no-tabs": "off",
"@stylistic/object-property-newline": "off",
"@stylistic/one-var-declaration-per-line": "off",
"@stylistic/operator-linebreak": ["error", "before"],
"@stylistic/padded-blocks": "off",
"@stylistic/quote-props": ["error", "consistent-as-needed"],
"@stylistic/quotes": ["error", "single"]
},
"overrides": [
{
"files": [
"test/**"
],
"rules": {
"no-unused-vars": "off"
}
}
]
}

7
debug.js Normal file
View file

@ -0,0 +1,7 @@
import {createClient} from './index.js';
import {profile} from './p/dbnav/index.js';
const client = createClient(profile, 'hafas-client-debug');
const journeys = await client.journeys('8000105', '8000261', {results: 1});
console.log(journeys);

69
eslint.config.mjs Normal file
View file

@ -0,0 +1,69 @@
import globals from 'globals';
import path from 'node:path';
import {fileURLToPath} from 'node:url';
import js from '@eslint/js';
import {FlatCompat} from '@eslint/eslintrc';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});
export default [{
ignores: ['**/node_modules', '**/*example.js'],
}, ...compat.extends('eslint:recommended', 'plugin:@stylistic/all-extends'), {
languageOptions: {
globals: {
...globals.node,
},
ecmaVersion: 2025,
sourceType: 'module',
},
rules: {
'curly': 'error',
'no-implicit-coercion': 'error',
'no-unused-vars': ['error', {
vars: 'all',
args: 'none',
ignoreRestSiblings: false,
}],
'@stylistic/array-bracket-newline': ['error', 'consistent'],
'@stylistic/array-element-newline': ['error', 'consistent'],
'@stylistic/arrow-parens': 'off',
'@stylistic/comma-dangle': ['error', 'always-multiline'],
'@stylistic/dot-location': ['error', 'property'],
'@stylistic/function-call-argument-newline': ['error', 'consistent'],
'@stylistic/function-paren-newline': 'off',
'@stylistic/indent': ['error', 'tab'],
'@stylistic/indent-binary-ops': ['error', 'tab'],
'@stylistic/max-len': 'off',
'@stylistic/multiline-ternary': ['error', 'always-multiline'],
'@stylistic/newline-per-chained-call': ['error', {
ignoreChainWithDepth: 1,
}],
'@stylistic/no-mixed-operators': 'off',
'@stylistic/no-tabs': 'off',
'@stylistic/object-property-newline': 'off',
'@stylistic/one-var-declaration-per-line': 'off',
'@stylistic/operator-linebreak': ['error', 'before'],
'@stylistic/padded-blocks': 'off',
'@stylistic/quote-props': ['error', 'consistent-as-needed'],
'@stylistic/quotes': ['error', 'single'],
},
}, {
files: ['test/**'],
rules: {
'no-unused-vars': 'off',
},
}];

2594
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -68,12 +68,15 @@
"uuid": "^11.0.5"
},
"devDependencies": {
"@eslint/eslintrc": "^3.2.0",
"@eslint/js": "^9.20.0",
"@pollyjs/adapter-node-http": "^6.0.5",
"@pollyjs/core": "^6.0.5",
"@pollyjs/persister-fs": "^6.0.5",
"@stylistic/eslint-plugin": "^1.5.1",
"db-rest": "github:derhuerst/db-rest",
"eslint": "^8.56.0",
"eslint": "^9.20.1",
"globals": "^15.15.0",
"hafas-rest-api": "^5.1.3",
"is-coordinates": "^2.0.2",
"is-roughly-equal": "^0.1.0",