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

Refactor eslint config #831

Merged
merged 1 commit into from
Jan 2, 2025
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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ jobs:
cache: npm
- name: Install dependencies
run: npm ci
- name: Run build
run: npm run build
- name: Run linter
run: npm run lint:check
- name: Run formatter
run: npm run prettier:check
- name: Run build
run: npm run build

run-tests:
name: Run tests
Expand Down
66 changes: 28 additions & 38 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,42 +1,32 @@
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import tsParser from "@typescript-eslint/parser";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/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 [{
ignores: ["**/node_modules", "**/dist", "**/*.js"],
}, ...compat.extends(
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
), {
files: ["**/*.ts", "**/*.tsx"],

plugins: {
"@typescript-eslint": typescriptEslint,
},

import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
export default tseslint.config(
{
ignores: [
'**/coverage',
'**/dist',
'**/__fixtures__',
'**/jest.config.js',
'**/jest.config.base.js',
'examples',
'packages/canonical-json',
'eslint.config.mjs',
],
},
eslint.configs.recommended,
tseslint.configs.recommendedTypeChecked,
{
languageOptions: {
parser: tsParser,
sourceType: "module",

parserOptions: {
project: "tsconfig.base.json",
},
parserOptions: {
projectService: ['./packages/*/tsconfig.json'],
tsconfigRootDir: import.meta.dirname,
},
},

rules: {
"@typescript-eslint/require-await": "error",
"@typescript-eslint/no-unused-vars": ["error", { "caughtErrors": "none" }]
"@typescript-eslint/no-base-to-string": "off",
"@typescript-eslint/no-unused-vars": ["error", { "caughtErrors": "none" }],
"@typescript-eslint/require-await": "error",
"@typescript-eslint/restrict-template-expressions": "off",
},
}];
}
);
Loading
Loading