Skip to content

Instantly share code, notes, and snippets.

@arash16
Created September 2, 2024 19:34
Show Gist options
  • Save arash16/57bc44d681858cce08f0d52fa3d85658 to your computer and use it in GitHub Desktop.
Save arash16/57bc44d681858cce08f0d52fa3d85658 to your computer and use it in GitHub Desktop.
module.exports = {
settings: {
'react': { version: 'detect' },
'import/extensions': ['.ts', '.js', '.tsx'],
'import/resolver': {
typescript: {
// alwaysTryTypes: true,
project: __dirname,
},
},
},
env: {
browser: true,
es2021: true,
},
plugins: [
'import',
'react',
'react-hooks',
'@typescript-eslint',
'unused-imports',
'eslint-plugin-unicorn',
'i18next',
'react-i18n',
],
extends: [
'plugin:unicorn/recommended',
'standard-with-typescript',
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:react-hooks/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:jsx-a11y/recommended',
'plugin:import/recommended',
'plugin:import/typescript',
'plugin:promise/recommended',
'plugin:tailwindcss/recommended',
'plugin:prettier/recommended',
],
overrides: [
{
env: {
node: true,
},
files: ['.eslintrc.{js,cjs}'],
parserOptions: {
sourceType: 'script',
},
},
],
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: true,
tsconfigRootDir: __dirname,
},
rules: {
// 'complexity': ['error', 11],
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'warn',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'warn',
'i18next/no-literal-string': 'warn',
'react-i18n/no-dynamic-translation-keys': 'error',
'react-i18n/no-missing-interpolation-keys': 'error',
'quotes': ['error', 'single', { avoidEscape: true }],
'unicorn/prevent-abbreviations': 'off',
'unicorn/no-null': 'off',
'unicorn/filename-case': 'off',
'unicorn/prefer-math-trunc': 'off',
'unicorn/prefer-string-slice': 'off',
'unicorn/no-await-expression-member': 'off',
'unicorn/consistent-function-scoping': 'off',
'unicorn/no-useless-undefined': ['error', { checkArguments: false }],
'unicorn/no-array-reduce': 'off',
'unicorn/no-array-callback-reference': 'off',
// 'quote-props': ['error', 'consistent-as-needed'],
'jsx-a11y/no-static-element-interactions': 'off',
'jsx-a11y/click-events-have-key-events': 'off',
'@typescript-eslint/no-explicit-any': 'warn',
'jsx-a11y/no-noninteractive-element-interactions': 'off',
'jsx-a11y/alt-text': 'off',
'jsx-a11y/anchor-is-valid': 'off',
'react/prop-types': 'off',
'react/jsx-no-target-blank': 'error',
'react/jsx-no-bind': ['error', { allowArrowFunctions: true }],
'react-hooks/exhaustive-deps': 'error',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/promise-function-async': 'off',
'@typescript-eslint/no-confusing-void-expression': 'off',
'@typescript-eslint/strict-boolean-expressions': 'off', // if(x) where x is not boolean
'@typescript-eslint/no-misused-promises': 'off', // no promise return where not necessary
'@typescript-eslint/consistent-type-assertions': 'error',
'@typescript-eslint/triple-slash-reference': 'error',
'@typescript-eslint/restrict-template-expressions': 'error',
'@typescript-eslint/no-floating-promises': 'error',
'@typescript-eslint/prefer-nullish-coalescing': 'off',
'@typescript-eslint/naming-convention': 'error',
'@typescript-eslint/no-non-null-assertion': 'error',
'@typescript-eslint/no-base-to-string': 'off',
// import
'import/default': 'off',
'import/no-cycle': 'error',
'import/no-self-import': 'error',
'import/no-useless-path-segments': 'error',
'import/no-relative-packages': 'error',
'import/export': 'error',
'import/no-named-as-default': 'error',
'import/no-named-as-default-member': 'error',
'import/no-deprecated': 'error',
'import/no-mutable-exports': 'error',
'import/no-unused-modules': [
'error',
// { unusedExports: true, missingExports: true },
],
'import/first': 'error',
'import/no-duplicates': 'error',
'import/no-named-default': 'error',
'import/no-unresolved': ['error', { ignore: ['\\.svg$'] }],
'import/no-unassigned-import': [
'error',
{ allow: ['**/*.css', 'tw-elements'] },
],
'import/no-anonymous-default-export': [
'error',
{
allowArray: true,
allowArrowFunction: true,
allowAnonymousClass: false,
allowAnonymousFunction: false,
allowCallExpression: true, // The true value here is for backward compatibility
allowLiteral: true,
allowObject: true,
},
],
'import/max-dependencies': [
'error',
{
max: 17,
ignoreTypeImports: true,
},
],
'import/order': [
'error',
{
groups: [
'builtin',
'external',
'internal',
'parent',
'sibling',
'index',
'object',
],
},
],
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'unused-imports/no-unused-imports': 'error',
'unused-imports/no-unused-vars': [
'error',
{
vars: 'all',
varsIgnorePattern: '^_',
args: 'after-used',
argsIgnorePattern: '^_',
},
],
'tailwindcss/no-custom-classname': 'error',
'prettier/prettier': [
'error',
{
endOfLine: 'auto',
},
],
},
};
{
"semi": true,
"tabWidth": 2,
"useTabs": false,
"singleQuote": true,
"trailingComma": "all",
"quoteProps": "consistent",
"arrowParens": "avoid",
"vueIndentScriptAndStyle": true,
"plugins": ["prettier-plugin-tailwindcss"],
"endOfLine": "auto"
}
{
"editor.bracketPairColorization.enabled": true,
"editor.guides.bracketPairs": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.tabSize": 2,
"editor.detectIndentation": false,
"editor.formatOnSave": false,
"editor.codeActionsOnSave": ["source.fixAll.eslint"],
"stylelint.packageManager": "yarn",
"stylelint.enable": true,
"stylelint.snippet": ["css", "postcss", "vue", "scss"],
"stylelint.validate": ["css", "postcss", "vue", "scss"],
"eslint.packageManager": "yarn",
"eslint.options": {
"overrideConfigFile": ".eslintrc.cjs"
},
"eslint.validate": [
"typescript",
"javascript",
"javascriptreact",
"javascriptvue",
"typescriptvue",
"html",
"vue",
"markdown"
],
"typescript.tsdk": "node_modules/typescript/lib",
"search.exclude": {
".huskey/**": true,
"**/*.lock": true,
"**/i18n/ja/**": true,
"**/i18n/zh/**": true,
"dist/**": true,
"patches/**": true
}
}
{
"devDependencies": {
"@babel/preset-react": "^7.22.5",
"@babel/preset-typescript": "^7.22.5",
"@typescript-eslint/eslint-plugin": "^5.52.0",
"@typescript-eslint/parser": "^6.4.0",
"eslint": "^8.0.1",
"eslint-config-prettier": "^9.0.0",
"eslint-config-standard-with-typescript": "^37.0.0",
"eslint-import-resolver-typescript": "^3.6.0",
"eslint-plugin-i18next": "^6.0.3",
"eslint-plugin-i18next-no-undefined-translation-keys": "^3.0.3",
"eslint-plugin-import": "^2.28.0",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-n": "^16.0.1",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-promise": "^6.0.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-i18n": "^1.0.3",
"eslint-plugin-tailwindcss": "^3.13.0",
"eslint-plugin-unicorn": "^48.0.1",
"eslint-plugin-unused-imports": "^3.0.0",
"husky": "^8.0.3",
"lint-staged": "^13.2.0",
"prettier": "3.0.2",
"prettier-plugin-tailwindcss": "^0.5.3",
"tailwindcss": "^3.4.1"
},
"lint-staged": {
"**/*.{js,jsx,ts,tsx}": [
"eslint",
"prettier --check"
],
"**/*.{html,css}": [
"prettier --check"
]
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment