Skip to content

Commit

Permalink
refactor eslint config
Browse files Browse the repository at this point in the history
Signed-off-by: Brian DeHamer <bdehamer@github.com>
  • Loading branch information
bdehamer committed Dec 31, 2024
1 parent 3236bff commit 3ce362e
Show file tree
Hide file tree
Showing 14 changed files with 201 additions and 147 deletions.
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

0 comments on commit 3ce362e

Please sign in to comment.