Update to eslint v9

This commit is contained in:
starraiderx
2024-04-09 01:47:10 +02:00
parent 30ee2e8a9d
commit cbe06266c2
6 changed files with 1268 additions and 1670 deletions

View File

@@ -1,4 +0,0 @@
dist
node_modules
.github
types.generated.d.ts

View File

@@ -1,53 +0,0 @@
/** @type {import("eslint").Linter.Config} */
module.exports = {
env: {
node: true,
es2022: true,
browser: true,
},
extends: ['eslint:recommended', 'plugin:astro/recommended'],
parser: '@typescript-eslint/parser',
parserOptions: {
tsconfigRootDir: __dirname,
ecmaVersion: 'latest',
sourceType: 'module',
},
rules: {},
overrides: [
{
files: ['*.js'],
rules: {
'no-mixed-spaces-and-tabs': ['error', 'smart-tabs'],
},
},
{
files: ['*.astro'],
parser: 'astro-eslint-parser',
parserOptions: {
parser: '@typescript-eslint/parser',
extraFileExtensions: ['.astro'],
},
rules: {
'no-mixed-spaces-and-tabs': ['error', 'smart-tabs'],
},
},
{
files: ['*.ts'],
parser: '@typescript-eslint/parser',
extends: ['plugin:@typescript-eslint/recommended'],
rules: {
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_', destructuredArrayIgnorePattern: '^_' },
],
'@typescript-eslint/no-non-null-assertion': 'off',
},
},
{
// Define the configuration for `<script>` tag.
// Script in `<script>` is assigned a virtual file name with the `.js` extension.
files: ['**/*.astro/*.js', '*.astro/*.js'],
parser: '@typescript-eslint/parser',
},
],
};

58
eslint.config.js Normal file
View File

@@ -0,0 +1,58 @@
import astroEslintParser from 'astro-eslint-parser';
import eslintPluginAstro from 'eslint-plugin-astro';
import globals from 'globals';
import js from '@eslint/js';
import tseslint from 'typescript-eslint';
import typescriptParser from '@typescript-eslint/parser';
export default [
js.configs.recommended,
...eslintPluginAstro.configs['flat/recommended'],
...tseslint.configs.recommended,
{
languageOptions: {
globals: {
...globals.browser,
},
},
},
{
files: ['**/*.astro'],
languageOptions: {
parser: astroEslintParser,
parserOptions: {
parser: '@typescript-eslint/parser',
extraFileExtensions: ['.astro'],
},
},
},
{
files: ['**/*.{js,jsx,astro}'],
rules: {
'no-mixed-spaces-and-tabs': ['error', 'smart-tabs'],
},
},
{
// Define the configuration for `<script>` tag.
// Script in `<script>` is assigned a virtual file name with the `.js` extension.
files: ['**/*.{ts,tsx}', '**/*.astro/*.js'],
languageOptions: {
parser: typescriptParser,
},
rules: {
// Note: you must disable the base rule as it can report incorrect errors
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
argsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
},
],
'@typescript-eslint/no-non-null-assertion': 'off',
},
},
{
ignores: ['dist', 'node_modules', '.github', 'types.generated.d.ts'],
},
];

2818
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -14,7 +14,7 @@
"preview": "astro preview",
"astro": "astro",
"format": "prettier -w .",
"lint:eslint": "eslint . --ext .js,.ts,.astro"
"lint:eslint": "eslint ."
},
"dependencies": {
"@astrojs/rss": "^4.0.5",
@@ -42,9 +42,10 @@
"@typescript-eslint/eslint-plugin": "^7.6.0",
"@typescript-eslint/parser": "^7.6.0",
"astro-eslint-parser": "^0.17.0",
"eslint": "^8.57.0",
"eslint": "^9.0.0",
"eslint-plugin-astro": "^0.34.0",
"eslint-plugin-jsx-a11y": "^6.8.0",
"globals": "^15.0.0",
"js-yaml": "^4.1.0",
"mdast-util-to-string": "^4.0.0",
"prettier": "^3.2.5",