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

chore(eslint): Migrate eslint to the new flat configuration format #1214

Merged
merged 6 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
79 changes: 0 additions & 79 deletions .eslintrc

This file was deleted.

88 changes: 88 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
const EslintTypeScriptParser = require("@typescript-eslint/parser");
const ts = require("@typescript-eslint/eslint-plugin");
mwangggg marked this conversation as resolved.
Show resolved Hide resolved
const EslintPluginReactHooks = require("eslint-plugin-react-hooks");
const EslintPluginReact = require("eslint-plugin-react");
const EslintPluginImport = require("eslint-plugin-import");
const EslintPluginUnusedImports = require("eslint-plugin-unused-imports");
const EslintTypeScriptPlugin = require("@typescript-eslint/eslint-plugin");
const Prettier = require("prettier");

module.exports = [{
ignores: ['src/mirage/', '**/node_modules/'],
},
{
files: ['**/*.{ts,tsx,js}'],
languageOptions: {
// tells eslint to use the TypeScript parser
parser: EslintTypeScriptParser,
// tell the TypeScript parser that we want to use JSX syntax
parserOptions: {
"tsx": true,
"jsx": true,
"js": true,
"useJSXTextNode": true,
"project": "./tsconfig.json",
"tsconfigRootDir": "."
},
globals: {
"window": "readonly",
"describe": "readonly",
"test": "readonly",
"expect": "readonly",
"it": "readonly",
"process": "readonly",
"document": "readonly"
},
},
settings: {
"react": {
"version": "detect"
}
},
// includes the typescript specific rules found here: https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin#supported-rules
plugins: {
"@typescript-eslint": ts,
"react-hooks": EslintPluginReactHooks,
"react": EslintPluginReact,
"eslint-plugin-react-hooks": EslintPluginReactHooks,
"unused-imports": EslintPluginUnusedImports,
"import": EslintPluginImport,
"prettier": Prettier
},
rules: {
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/interface-name-prefix": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/triple-slash-reference": ["error", { "lib": "always", "path": "always", "types": "prefer-import" }],
"import/extensions": "off",
"import/no-cycle": "warn",
"import/no-named-as-default": "off",
"import/no-unresolved": "off",
"import/order": ["warn", {
"groups": ["builtin", "external", "internal", "parent", "sibling", "index"],
"alphabetize": {
"order": "asc",
"caseInsensitive": true
}
}],
"no-console": ["error", {
"allow": ["warn", "error"]
}],
"prettier/prettier": "off",
"react/prop-types": "off",
"react/jsx-uses-react": "warn",
"react/jsx-uses-vars": "warn",
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "error",
"unused-imports/no-unused-imports": "warn",
"unused-imports/no-unused-vars": [
"warn",
{ "vars": "all", "varsIgnorePattern": "^_", "args": "after-used", "argsIgnorePattern": "^_" }
]
}
}];
//EslintPluginReact.configs["jsx-runtime", "recommended"],
//EslintPluginImport.configs.recommended,
//EslintPluginImport.configs.typescript,
//ts.configs.recommended,
mwangggg marked this conversation as resolved.
Show resolved Hide resolved
Loading
Loading