1+ {% func NodeEslintrc() %}
2+ module.exports = {
3+ parser: '@typescript-eslint/parser',
4+ parserOptions: {
5+ project: 'tsconfig.base.json',
6+ sourceType: 'module',
7+ },
8+ plugins: ['@typescript-eslint/eslint-plugin', 'import'],
9+ extends: ['plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'],
10+ root: true,
11+ env: {
12+ node: true,
13+ jest: true,
14+ },
15+ ignorePatterns: ['.eslintrc.js'],
16+ rules: {
17+ '@typescript-eslint/interface-name-prefix': 'off',
18+ '@typescript-eslint/explicit-function-return-type': 'off',
19+ '@typescript-eslint/explicit-module-boundary-types': 'off',
20+ '@typescript-eslint/no-explicit-any': 'off',
21+ '@typescript-eslint/no-empty-function': 'off',
22+ 'import/order': [
23+ 'error',
24+ {
25+ groups: ['builtin', 'external', 'internal', 'sibling', 'parent'],
26+ 'newlines-between': 'always-and-inside-groups',
27+ },
28+ ],
29+ },
30+ };
31+ {% endfunc %}
32+
33+ {% func ReactEslintrc() %}
34+ module.exports = {
35+ env: {
36+ browser: true,
37+ es2021: true
38+ },
39+ extends: ['airbnb', 'plugin:react/recommended', 'plugin:react-hooks/recommended', 'prettier'],
40+ parser: '@typescript-eslint/parser',
41+ ignorePatterns: ['.eslintrc.js'],
42+ parserOptions: {
43+ ecmaFeatures: {
44+ jsx: true
45+ },
46+ ecmaVersion: 12,
47+ sourceType: 'module'
48+ },
49+ plugins: ['react', '@typescript-eslint', 'import'],
50+ rules: {
51+ // built-in
52+ 'no-unused-vars': 'off',
53+ 'no-use-before-define': 'off',
54+
55+ // react
56+ 'react/jsx-filename-extension': [1, { extensions: ['.tsx', '.jsx', '.js'] }],
57+ 'react/react-in-jsx-scope': 'off',
58+ 'react/jsx-props-no-spreading': 'off',
59+
60+ // import
61+ 'import/extensions': 'off',
62+ 'import/order': [
63+ 'error',
64+ {
65+ groups: ['builtin', 'external', 'internal', 'parent', 'sibling'],
66+ 'newlines-between': 'always',
67+ pathGroups: [
68+ {
69+ pattern: 'react',
70+ group: 'builtin'
71+ },
72+ {
73+ pattern: 'next/**',
74+ group: 'builtin'
75+ }
76+ ],
77+ pathGroupsExcludedImportTypes: ['builtin', 'object']
78+ }
79+ ]
80+ },
81+ settings: {
82+ 'import/parsers': {
83+ '@typescript-eslint/parser': ['.ts', '.tsx']
84+ },
85+ 'import/resolver': {
86+ typescript: {
87+ project: 'tsconfig.json'
88+ }
89+ }
90+ }
91+ };
92+ {% endfunc %}
93+
94+ {% func ReactTsConfig() %}
95+ {
96+ "compilerOptions": {
97+ "target": "es5",
98+ "lib": [
99+ "dom",
100+ "dom.iterable",
101+ "esnext"
102+ ],
103+ "allowJs": true,
104+ "skipLibCheck": true,
105+ "strict": false,
106+ "forceConsistentCasingInFileNames": true,
107+ "noEmit": true,
108+ "esModuleInterop": true,
109+ "module": "esnext",
110+ "moduleResolution": "node",
111+ "resolveJsonModule": true,
112+ "isolatedModules": true,
113+ "jsx": "preserve"
114+ },
115+ "include": [
116+ "next-env.d.ts",
117+ "**/*.ts",
118+ "**/*.tsx"
119+ ],
120+ "exclude": [
121+ "node_modules"
122+ ]
123+ }
124+ {% endfunc %}
125+
126+ {% func NodeTsConfig() %}
127+ {
128+ "compilerOptions": {
129+ "module": "commonjs",
130+ "declaration": true,
131+ "removeComments": true,
132+ "allowSyntheticDefaultImports": true,
133+ "target": "es2017",
134+ "sourceMap": true,
135+ "outDir": "./dist",
136+ "baseUrl": "./",
137+ "incremental": true,
138+ "esModuleInterop": true,
139+ }
140+ }
141+ {% endfunc %}
0 commit comments