1+ import eslintPluginTypeScript from "@typescript-eslint/eslint-plugin"
2+ import eslintParserTypeScript from "@typescript-eslint/parser"
3+ import eslintPluginImport from "eslint-plugin-import"
4+ import eslintPluginSimpleImportSort from "eslint-plugin-simple-import-sort"
5+ import eslintConfigPrettier from "eslint-config-prettier"
6+ import eslintPluginPrettier from "eslint-plugin-prettier"
7+
8+ export default [
9+ {
10+ ignores : [ "node_modules/**" , "**/dist/**" , "**/build/**" , "**/.prettierrc.*" , "./src/types/**" ]
11+ } ,
12+ {
13+ files : [ "**/*.{ts,tsx}" ] ,
14+ languageOptions : {
15+ ecmaVersion : "latest" ,
16+ sourceType : "module" ,
17+ parser : eslintParserTypeScript ,
18+ parserOptions : {
19+ project : "./tsconfig.json"
20+ }
21+ } ,
22+ plugins : {
23+ "@typescript-eslint" : eslintPluginTypeScript ,
24+ prettier : eslintPluginPrettier ,
25+ import : eslintPluginImport ,
26+ "simple-import-sort" : eslintPluginSimpleImportSort
27+ } ,
28+ rules : {
29+ ...eslintPluginTypeScript . configs . recommended . rules ,
30+ "@typescript-eslint/no-namespace" : "off" ,
31+ "@typescript-eslint/no-unused-vars" : [ "error" ] ,
32+ "@typescript-eslint/explicit-function-return-type" : "error" ,
33+ "@typescript-eslint/no-explicit-any" : "error" ,
34+
35+ "prettier/prettier" : [
36+ "error" ,
37+ {
38+ "semi" : false ,
39+ "singleQuote" : true ,
40+ "trailingComma" : "es5" ,
41+ "arrowParens" : "always" ,
42+ "bracketSpacing" : true ,
43+ "printWidth" : 120 ,
44+ "tabWidth" : 2 ,
45+ "useTabs" : false
46+ }
47+ ] ,
48+
49+ "simple-import-sort/imports" : [
50+ "error" ,
51+ {
52+ groups : [
53+ [ "^@?\\w" ] ,
54+ [ "^\\.\\.(?!/?$)" , "^\\.\\./?$" ] ,
55+ [ "^\\./(?=.*/)(?!/?$)" , "^\\.(?!/?$)" , "^\\./?$" ]
56+ ]
57+ }
58+ ] ,
59+ "simple-import-sort/exports" : "error" ,
60+
61+ "comma-spacing" : [ "error" , { before : false , after : true } ] ,
62+ "no-multiple-empty-lines" : [ "error" , { max : 1 , maxEOF : 1 } ]
63+ } ,
64+ settings : {
65+ "import/resolver" : {
66+ typescript : {
67+ alwaysTryTypes : true ,
68+ project : "./tsconfig.json"
69+ }
70+ }
71+ }
72+ } ,
73+ // configuration for test files
74+ {
75+ files : [ "tests/**/*.{ts,tsx}" , "**/*.spec.{ts,tsx}" , "**/*.test.{ts,tsx}" ] ,
76+ languageOptions : {
77+ ecmaVersion : "latest" ,
78+ sourceType : "module" ,
79+ parser : eslintParserTypeScript ,
80+ parserOptions : {
81+ project : "./tests/tsconfig.json"
82+ }
83+ } ,
84+ rules : {
85+ "@typescript-eslint/no-unused-expressions" : "off"
86+ }
87+ } ,
88+ eslintConfigPrettier
89+ ]
0 commit comments