mirror of
https://github.com/yangshun/tech-interview-handbook.git
synced 2025-07-29 21:23:14 +08:00
feat: scaffold monorepo
This commit is contained in:
147
packages/eslint-config-tih/index.js
Normal file
147
packages/eslint-config-tih/index.js
Normal file
@ -0,0 +1,147 @@
|
||||
/* eslint-disable sort-keys-fix/sort-keys-fix */
|
||||
|
||||
const OFF = 0;
|
||||
const WARN = 1;
|
||||
const ERROR = 2;
|
||||
|
||||
module.exports = {
|
||||
parser: '@typescript-eslint/parser',
|
||||
plugins: [
|
||||
'@typescript-eslint',
|
||||
'simple-import-sort',
|
||||
'sort-keys-fix',
|
||||
'typescript-sort-keys',
|
||||
],
|
||||
extends: [
|
||||
'next',
|
||||
'eslint:recommended',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'prettier',
|
||||
],
|
||||
settings: {
|
||||
react: {
|
||||
version: 'detect',
|
||||
},
|
||||
},
|
||||
rules: {
|
||||
camelcase: [ERROR, { properties: 'never', ignoreDestructuring: true }],
|
||||
'capitalized-comments': [
|
||||
ERROR,
|
||||
'always',
|
||||
{ ignoreConsecutiveComments: true },
|
||||
],
|
||||
'consistent-this': ERROR,
|
||||
curly: ERROR,
|
||||
'dot-notation': ERROR,
|
||||
eqeqeq: [ERROR, 'smart'],
|
||||
'func-name-matching': ERROR,
|
||||
'func-names': [ERROR, 'as-needed'],
|
||||
'func-style': [ERROR, 'declaration', { allowArrowFunctions: true }],
|
||||
'guard-for-in': ERROR,
|
||||
'init-declarations': ERROR,
|
||||
'no-console': [ERROR, { allow: ['warn', 'error', 'info'] }],
|
||||
'no-else-return': [ERROR, { allowElseIf: false }],
|
||||
'no-extra-boolean-cast': ERROR,
|
||||
'no-lonely-if': ERROR,
|
||||
'no-shadow': ERROR,
|
||||
'no-unused-vars': OFF, // Use @typescript-eslint/no-unused-vars instead.
|
||||
'object-shorthand': ERROR,
|
||||
'one-var': [ERROR, 'never'],
|
||||
'operator-assignment': ERROR,
|
||||
'prefer-arrow-callback': ERROR,
|
||||
'prefer-const': ERROR,
|
||||
'prefer-destructuring': [
|
||||
ERROR,
|
||||
{
|
||||
object: true,
|
||||
},
|
||||
],
|
||||
radix: ERROR,
|
||||
'spaced-comment': ERROR,
|
||||
|
||||
'react/button-has-type': ERROR,
|
||||
'react/display-name': OFF,
|
||||
'react/destructuring-assignment': [ERROR, 'always'],
|
||||
// 'react/hook-use-state': ERROR,
|
||||
'react/no-array-index-key': ERROR,
|
||||
'react/no-unescaped-entities': OFF,
|
||||
'react/void-dom-elements-no-children': ERROR,
|
||||
|
||||
'react/jsx-boolean-value': [ERROR, 'always'],
|
||||
'react/jsx-curly-brace-presence': [
|
||||
ERROR,
|
||||
{ props: 'never', children: 'never' },
|
||||
],
|
||||
'react/jsx-no-useless-fragment': ERROR,
|
||||
'react/jsx-sort-props': [
|
||||
ERROR,
|
||||
{
|
||||
callbacksLast: true,
|
||||
shorthandFirst: true,
|
||||
reservedFirst: true,
|
||||
},
|
||||
],
|
||||
|
||||
'@next/next/no-img-element': OFF,
|
||||
'@next/next/no-html-link-for-pages': OFF,
|
||||
|
||||
'@typescript-eslint/array-type': [
|
||||
ERROR,
|
||||
{ default: 'generic', readonly: 'generic' },
|
||||
],
|
||||
'@typescript-eslint/consistent-generic-constructors': [
|
||||
ERROR,
|
||||
'constructor',
|
||||
],
|
||||
'@typescript-eslint/consistent-indexed-object-style': [ERROR, 'record'],
|
||||
'@typescript-eslint/consistent-type-definitions': [ERROR, 'type'],
|
||||
'@typescript-eslint/consistent-type-imports': ERROR,
|
||||
'@typescript-eslint/no-duplicate-enum-values': ERROR,
|
||||
'@typescript-eslint/no-for-in-array': ERROR,
|
||||
'@typescript-eslint/no-non-null-assertion': OFF,
|
||||
'@typescript-eslint/no-unused-vars': [ERROR, { argsIgnorePattern: '^_' }],
|
||||
'@typescript-eslint/prefer-optional-chain': ERROR,
|
||||
'@typescript-eslint/require-array-sort-compare': ERROR,
|
||||
'@typescript-eslint/restrict-plus-operands': ERROR,
|
||||
'@typescript-eslint/sort-type-union-intersection-members': ERROR,
|
||||
|
||||
// Sorting
|
||||
'typescript-sort-keys/interface': ERROR,
|
||||
'typescript-sort-keys/string-enum': ERROR,
|
||||
'sort-keys-fix/sort-keys-fix': ERROR,
|
||||
'simple-import-sort/exports': WARN,
|
||||
'simple-import-sort/imports': [
|
||||
WARN,
|
||||
{
|
||||
groups: [
|
||||
// Ext library & side effect imports.
|
||||
['^~?\\w', '^\\u0000', '^@'],
|
||||
// Lib and hooks.
|
||||
['^~/lib', '^~/hooks'],
|
||||
// Static data.
|
||||
['^~/data'],
|
||||
// Components.
|
||||
['^~/components'],
|
||||
// Other imports.
|
||||
['^~/'],
|
||||
// Relative paths up until 3 level.
|
||||
[
|
||||
'^\\./?$',
|
||||
'^\\.(?!/?$)',
|
||||
'^\\.\\./?$',
|
||||
'^\\.\\.(?!/?$)',
|
||||
'^\\.\\./\\.\\./?$',
|
||||
'^\\.\\./\\.\\.(?!/?$)',
|
||||
'^\\.\\./\\.\\./\\.\\./?$',
|
||||
'^\\.\\./\\.\\./\\.\\.(?!/?$)',
|
||||
],
|
||||
['^~/types'],
|
||||
// {s}css files
|
||||
['^.+\\.s?css$'],
|
||||
// Others that don't fit in.
|
||||
['^'],
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
21
packages/eslint-config-tih/package.json
Normal file
21
packages/eslint-config-tih/package.json
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "eslint-config-tih",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"@typescript-eslint/eslint-plugin": "^5.33.0",
|
||||
"@typescript-eslint/parser": "^5.33.0",
|
||||
"eslint-config-next": "^12.3.1",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint-plugin-react": "7.28.0",
|
||||
"eslint-plugin-simple-import-sort": "^7.0.0",
|
||||
"eslint-plugin-sort-keys-fix": "^1.1.2",
|
||||
"eslint-plugin-typescript-sort-keys": "^2.1.0",
|
||||
"eslint-config-turbo": "latest"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user