Skip to content

Commit 2aec095

Browse files
authored
Merge pull request #251 from bensaufley/eslint-9
Update to ESLint 9 and add Solid-JS eslint plugin, which revealed some things
2 parents d2f8356 + 0d4a29f commit 2aec095

27 files changed

+923
-682
lines changed

.eslintignore

Lines changed: 0 additions & 6 deletions
This file was deleted.

.eslintrc.cjs

Lines changed: 0 additions & 56 deletions
This file was deleted.

astro.config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
/// <reference types="vite/client" />
33
/// <reference types="vite-plugin-solid-svg/types" />
44

5-
/* eslint-disable import/no-extraneous-dependencies */
65
import mdx from '@astrojs/mdx';
76
import partytown from '@astrojs/partytown';
87
import sitemap from '@astrojs/sitemap';

codegen.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* eslint-disable no-console */
21
import type { CodegenConfig } from '@graphql-codegen/cli';
32
import { execSync } from 'child_process';
43

eslint.config.ts

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/* eslint-disable import/no-extraneous-dependencies */
2+
import bslint from '@bensaufley/eslint-config';
3+
import type { Linter } from 'eslint';
4+
import astro from 'eslint-plugin-astro';
5+
import { configs as mdx } from 'eslint-plugin-mdx';
6+
import solid from 'eslint-plugin-solid/configs/typescript';
7+
8+
const config: Linter.Config[] = [
9+
{
10+
name: 'Global Ignores',
11+
ignores: ['.astro', 'node_modules', 'dist', 'src/components/Gtag.astro', '!.*.js', '!.*.cjs', '!.*.ts'],
12+
},
13+
...bslint,
14+
{
15+
files: ['src/**/*.tsx', 'src/**/*.ts'],
16+
...(solid as unknown as Linter.Config),
17+
},
18+
...astro.configs['flat/recommended'],
19+
{
20+
rules: {
21+
'implicit-arrow-linebreak': 'off',
22+
'import/no-unresolved': ['error', { ignore: ['astro:content'] }],
23+
},
24+
languageOptions: {
25+
globals: {
26+
dataLayer: 'writable',
27+
gtag: 'writable',
28+
partytown: 'writable',
29+
},
30+
},
31+
},
32+
{
33+
files: ['*.mdx'],
34+
...mdx.flat,
35+
rules: {
36+
'@typescript-eslint/consistent-type-imports': 'off',
37+
'import/prefer-default-export': 'off',
38+
39+
// These rules generate false positives, unfortunately
40+
'no-unused-vars': 'off',
41+
'@typescript-eslint/no-unused-vars': 'off',
42+
},
43+
},
44+
mdx.flatCodeBlocks,
45+
{
46+
files: ['**/*.astro'],
47+
rules: {
48+
'import/prefer-default-export': 'off',
49+
// doesn't play nice with Astro
50+
'prettier/prettier': 'off',
51+
},
52+
},
53+
{
54+
files: ['script/**/*'],
55+
rules: {
56+
'no-console': 'off',
57+
'no-await-in-loop': 'off',
58+
'import/no-extraneous-dependencies': 'off',
59+
},
60+
},
61+
];
62+
63+
export default config;

0 commit comments

Comments
 (0)