Skip to content

Commit

Permalink
Merge pull request #259 from fire332/upgrade-deps
Browse files Browse the repository at this point in the history
Upgrade deps
  • Loading branch information
fire332 authored Feb 2, 2025
2 parents 04bf2d6 + 69f57b9 commit abcc766
Show file tree
Hide file tree
Showing 5 changed files with 203 additions and 182 deletions.
20 changes: 11 additions & 9 deletions eslint.config.js → eslint.config.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
import assert from 'node:assert';

import eslintJs from '@eslint/js';
import type { ESLint, Linter } from 'eslint';
import stylistic from '@stylistic/eslint-plugin';
import prettierConfig from 'eslint-config-prettier';
import * as regexpPlugin from 'eslint-plugin-regexp';
import globals from 'globals';
import pkgJson from './package.json' with { type: 'json' };

const defaultSourceType =
/** @type {import('eslint').Linter.SourceType | undefined} */ (
pkgJson.type
) ?? 'commonjs';
const defaultSourceType: Linter.SourceType = 'module';
assert(pkgJson.type === defaultSourceType);

/** @satisfies {import('eslint').Linter.Config[]} */
export default [
const configs = [
eslintJs.configs.recommended,
prettierConfig,
regexpPlugin.configs['flat/recommended'],

{
plugins: {
'@stylistic': stylistic
// Cast needed due to type mismatch even though this is the recommmended way to use the plugin.
'@stylistic': stylistic as ESLint.Plugin
},

linterOptions: {
Expand Down Expand Up @@ -61,7 +62,6 @@ export default [

// @stylistic rules - needed as prettier doesn't handle these
'@stylistic/quotes': ['error', 'single', { avoidEscape: true }],
'@stylistic/object-curly-spacing': ['error', 'always'],

/* eslint-plugin-regexp */
'regexp/prefer-character-class': ['error', { minAlternatives: 2 }],
Expand Down Expand Up @@ -103,4 +103,6 @@ export default [
// `ignores` field must be in the very bottom config.
ignores: ['dist/**/*', '**/*-polyfill.*']
}
];
] as const satisfies Linter.Config[];

export default configs;
2 changes: 1 addition & 1 deletion lint-staged.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ function globForCode(/** @type {string} */ toolName) {
return '*.?(c|m){js,ts}?(x)' + `*(${toolName})`;
}

/** @type {import('lint-staged').Config} */
/** @type {import('lint-staged').Configuration} */
export default {
'*': 'prettier --ignore-unknown --write',
[globForCode('eslint')]: 'eslint',
Expand Down
Loading

0 comments on commit abcc766

Please sign in to comment.