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

build: eslint configuration #56

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
build: eslint configuration
- Add eslint-plugin-react and eslint-plugin-jsx-a11y and use the
  recommended and jsx-runtime configurations and strict configuration on
  .tsx files only
- Add @eslint/json and use the recommended configuration on .json files,
  treat tsconfig files as jsonc
  • Loading branch information
matijs committed Oct 17, 2024
commit a7076ad389f868afa40b04638c026ca1695979ce
35 changes: 29 additions & 6 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,23 +1,46 @@
import globals from 'globals';
import json from '@eslint/json';
import js from '@eslint/js';
import tseslint from 'typescript-eslint';
import eslintConfigPrettier from 'eslint-config-prettier';
import eslintPluginJsxA11y from 'eslint-plugin-jsx-a11y';
import eslintPluginReact from 'eslint-plugin-react';

export default tseslint.config(
{
name: 'global-ignores',
ignores: ['**/dist/'],
ignores: ['**/dist/', '**/node_modules/'],
},
{
languageOptions: {
globals: { ...globals.node },
parserOptions: {
warnOnUnsupportedTypeScriptVersion: false,
},
},
linterOptions: {
reportUnusedDisableDirectives: true,
},
{
files: ['**/*.js', '**/*.cjs', '**/*.mjs'],
languageOptions: {
globals: { ...globals.node },
},
...js.configs.recommended,
},
{
files: ['**/*.json'],
language: 'json/json',
...json.configs.recommended,
},
{
files: ['**/tsconfig.json', '**/tsconfig.*.json'],
language: 'json/jsonc',
...json.configs.recommended,
},
js.configs.recommended,
...tseslint.configs.recommended,
{
files: ['**/*.tsx'],
...eslintPluginReact.configs.flat.recommended,
...eslintPluginReact.configs.flat['jsx-runtime'],
...eslintPluginJsxA11y.flatConfigs.strict,
},
{
files: ['**/*.cjs'],
rules: {
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@babel/preset-typescript": "7.25.7",
"@changesets/cli": "2.27.9",
"@eslint/js": "9.12.0",
"@eslint/json": "0.5.0",
"@rollup/plugin-babel": "6.0.4",
"@rollup/plugin-node-resolve": "15.3.0",
"@rollup/plugin-typescript": "12.1.1",
Expand All @@ -34,6 +35,7 @@
"@types/node": "22.7.5",
"eslint": "9.12.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-jsx-a11y": "6.10.0",
"eslint-plugin-react": "7.37.1",
"globals": "15.11.0",
"husky": "9.1.6",
Expand Down
Loading