Skip to content

chore: update to eslint v9 #955

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
41 changes: 0 additions & 41 deletions .eslintrc.json

This file was deleted.

124 changes: 124 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
import { defineConfig, globalIgnores } from 'eslint/config';
import react from 'eslint-plugin-react';
// import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
import globals from 'globals';
// import babelParser from '@babel/eslint-parser';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import json from '@eslint/json';
import js from '@eslint/js';
import stylisticJs from '@stylistic/eslint-plugin-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 defineConfig([
// ignoring for now, many unformatted files
// eslintPluginPrettierRecommended,
{
plugins: {
json,
'@stylistic/js': stylisticJs,
},
},
{
files: ['**/*.json'],
language: 'json/json',
rules: {
'json/no-duplicate-keys': 'error',
},
},

{
files: ['**/*.js'],
plugins: {
js,
},
extends: ['js/recommended'],
rules: {
'no-unused-vars': 'warn',
'no-undef': 'warn',
},
},
{
files: ['**/*.{js,jsx,mjs,cjs,ts,tsx}'],
plugins: {
react,
},
languageOptions: {
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
globals: {
...globals.browser, // causes error
...globals.node,
...globals.commonjs,
},
},
settings: {
react: {
version: 'detect',
},
},
rules: {
'no-async-promise-executor': 'off',
'react/jsx-uses-react': 'error',
'react/jsx-uses-vars': 'error',
'react/prop-types': 'off',
// ignoring for now, many long lines
// '@stylistic/js/max-len': ['error', { code: 100 }],
},
},
{
files: ['test/**/*.{js,mjs,cjs,ts}'],
languageOptions: {
globals: {
...globals.mocha,
},
},
},
// {
// extends: compat.extends('prettier', 'plugin:json/recommended'),

// plugins: {
// react,
// prettier,
// },

// languageOptions: {
// globals: {
// ...globals.node,
// // causes error:
// // TypeError: Key "languageOptions": Key "globals": Global "AudioWorkletGlobalScope " has leading or trailing whitespace.
// // ...globals.browser,
// ...globals.commonjs,
// ...globals.mocha,
// },

// parser: babelParser,
// ecmaVersion: 12,
// sourceType: 'module',

// parserOptions: {
// requireConfigFile: false,

// ecmaFeatures: {
// jsx: true,
// modules: true,
// },

// babelOptions: {
// presets: ['@babel/preset-react'],
// },
// },
// },
// },
]);
Loading
Loading