From facf888664f93c95d0559b44db23076948fc3296 Mon Sep 17 00:00:00 2001 From: Chukkrit Visitsaktavorn Date: Thu, 15 Apr 2021 18:56:55 +0700 Subject: [PATCH] add eslint --- .editorconfig | 11 +++++++++++ .eslintrc.js | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ .gitignore | 1 + .prettierrc | 5 +++++ 4 files changed, 68 insertions(+) create mode 100644 .editorconfig create mode 100644 .eslintrc.js create mode 100644 .prettierrc diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..8951c39 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,11 @@ +# editorconfig.org +root = true + +[*] +indent_style = space +indent_size = 2 +tab_width = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..fcc11ea --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,51 @@ +module.exports = { + env: { + browser: true, + es2021: true, + jest: true, + node: true, + }, + parser: '@typescript-eslint/parser', + plugins: ['react', '@typescript-eslint'], + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + ecmaVersion: 12, + sourceType: 'module', + }, + extends: [ + 'eslint:recommended', + 'plugin:react/recommended', + 'plugin:@typescript-eslint/recommended', + 'plugin:react-hooks/recommended', + // Uncomment the following lines to enable eslint-config-prettier + // Is not enabled right now to avoid issues with the Next.js repo + 'prettier', + ], + settings: { + react: { + version: 'detect', + }, + }, + rules: { + 'react/prop-types': 0, + 'react/react-in-jsx-scope': 0, + '@typescript-eslint/explicit-function-return-type': 0, + '@typescript-eslint/explicit-member-accessibility': 0, + '@typescript-eslint/indent': 0, + '@typescript-eslint/member-delimiter-style': 0, + '@typescript-eslint/ban-ts-comment': 0, + '@typescript-eslint/no-explicit-any': 0, + '@typescript-eslint/no-var-requires': 0, + '@typescript-eslint/no-use-before-define': 0, + '@typescript-eslint/no-empty-function': 0, + '@typescript-eslint/no-unused-vars': [ + 2, + { + argsIgnorePattern: '^_', + }, + ], + 'no-console': 0, + }, +} diff --git a/.gitignore b/.gitignore index d451ff1..922f516 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ node_modules dist dist-ssr *.local +.eslintcache diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..e65c538 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,5 @@ +{ + "singleQuote": true, + "semi": false, + "printWidth": 120 +}