UNPKG

@cruk/eslint-config

Version:

eslint rules for cruk typescript projects

42 lines (38 loc) 1.47 kB
import path from "path"; import { fileURLToPath } from "url"; import jsEslintPlugin from "@eslint/js"; import tsEslintPlugin from "typescript-eslint"; import promisePlugin from "eslint-plugin-promise"; import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended"; const __filename = fileURLToPath(import.meta.url); // get the resolved path to the file const __dirname = path.dirname(__filename); // get the name of the directory export const config = [ jsEslintPlugin.configs.recommended, ...tsEslintPlugin.configs.recommended, ...tsEslintPlugin.configs.stylistic, promisePlugin.configs["flat/recommended"], eslintPluginPrettierRecommended, { languageOptions: { parser: tsEslintPlugin.parser, parserOptions: { tsconfigRootDir: __dirname, project: ["./tsconfig.json"], }, }, rules: { // These off/not-configured-the-way-we-want lint rules we like & opt into "@typescript-eslint/no-unused-vars": [ "error", { argsIgnorePattern: "^_", destructuredArrayIgnorePattern: "^_" }, ], "@typescript-eslint/consistent-type-imports": [ "error", { prefer: "type-imports", fixStyle: "inline-type-imports" }, ], // There are times when interface is valid like when a subset of props is required, but type is more performant and prefferred "@typescript-eslint/consistent-type-definitions": "off", }, }, ]; export default config;