UNPKG

@phantomstudios/ft-lib

Version:

A collection of Javascript UI & tracking utils for FT sites

91 lines (77 loc) 2.5 kB
import { defineConfig } from "eslint/config"; import { fixupConfigRules, fixupPluginRules } from "@eslint/compat"; import prettier from "eslint-plugin-prettier"; import _import from "eslint-plugin-import"; import globals from "globals"; 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 defineConfig([{ ignores: [ "src/utils/intersectionObserverPolyfill.js", ], extends: fixupConfigRules(compat.extends( "plugin:react/recommended", "plugin:react-hooks/recommended", "plugin:@typescript-eslint/recommended", "plugin:prettier/recommended", )), plugins: { prettier: fixupPluginRules(prettier), import: fixupPluginRules(_import), }, languageOptions: { globals: { ...globals.browser, ...globals.node, ...globals.jest, React: "writable", }, parser: tsParser, ecmaVersion: 5, sourceType: "commonjs", parserOptions: { jsx: true, useJSXTextNode: true, }, }, settings: { react: { version: "detect", }, }, rules: { "react-hooks/rules-of-hooks": "error", "react-hooks/exhaustive-deps": "error", "react/react-in-jsx-scope": "off", "@typescript-eslint/explicit-function-return-type": "off", "@typescript-eslint/explicit-module-boundary-types": "off", "@typescript-eslint/ban-ts-comment": "off", "@typescript-eslint/no-explicit-any": "off", "react/prop-types": "off", "import/order": ["error", { groups: ["builtin", "external", "internal"], pathGroups: [{ pattern: "react", group: "external", position: "before", }], pathGroupsExcludedImportTypes: ["react"], "newlines-between": "always", alphabetize: { order: "asc", caseInsensitive: true, }, }], "prettier/prettier": "error", }, }]);