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

Misc dev changes #238

Merged
merged 8 commits into from
Dec 25, 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
6 changes: 6 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ function makeConfig(api) {
noNewArrows: true
},
plugins: [
[
'@babel/plugin-transform-typescript',
{
strictMode: true
}
],
[
'@babel/plugin-transform-runtime',
{
Expand Down
28 changes: 17 additions & 11 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
import Module from 'node:module';

import eslintJs from '@eslint/js';
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 require = Module.createRequire(import.meta.url);
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

/** @type {'module' | 'commonjs'} */
const defaultSourceType =
require(join(__dirname, 'package.json')).type ?? 'commonjs';
/** @type {import('eslint').Linter.SourceType | undefined} */ (
pkgJson.type
) ?? 'commonjs';

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

{
plugins: {
'@stylistic': stylistic
},

linterOptions: {
reportUnusedDisableDirectives: 'error'
},
Expand All @@ -44,6 +43,9 @@ export default [
'no-implicit-globals': ['error'],
'no-unused-vars': ['error', { vars: 'local', argsIgnorePattern: '^_' }],
'no-useless-rename': ['error'],
'no-useless-computed-key': 'error',
'no-useless-constructor': 'error',
'no-useless-return': 'error',
'arrow-body-style': ['error', 'as-needed'],
'no-lonely-if': 'error',
'prefer-object-has-own': 'error',
Expand All @@ -57,6 +59,10 @@ export default [
'no-unmodified-loop-condition': 'error',
'no-useless-assignment': 'error',

// @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 }],
'regexp/no-empty-alternative': 'error', // Set to warn in recommended config
Expand Down
Loading
Loading