Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/#13 Modify eslint settings(ESLintの設定を修正する) #14

Merged
merged 7 commits into from
Jun 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# config
.eslintrc.cjs
.prettierrc.cjs
.stylelint.cjs
next.config.cjs
tailwind.config.cjs
tsconfig.json
postcss.config.cjs

# build
build/
bin/
obj/
out/
.next/
128 changes: 112 additions & 16 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
/** @type {import('@typescript-eslint/experimental-utils').TSESLint.Linter.Config} */

const config = {
root: true,
env: {
browser: true,
node: true,
es2021: true,
},
extends: [
'eslint:recommended',
'airbnb',
'airbnb/hooks',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:jsx-a11y/recommended',
'next/core-web-vitals',
'plugin:tailwindcss/recommended',
'plugin:jest/recommended',
'plugin:jest/style',
'plugin:jest-dom/recommended',
'plugin:import/typescript',
'plugin:react/recommended',
'prettier',
],
Expand All @@ -24,10 +29,11 @@ const config = {
},
ecmaVersion: 'latest',
sourceType: 'module',
tsconfigRootDir: __dirname,
project: './tsconfig.json',
},
plugins: ['@typescript-eslint', 'unused-imports', 'jest', 'jest-dom'],
plugins: ['import', 'unused-imports', 'jsx-a11y', 'tailwindcss', '@typescript-eslint', 'jest', 'jest-dom'],
rules: {
/* eslint */
'no-unused-vars': 'off',
'arrow-body-style': 'off',
'no-restricted-syntax': [
Expand All @@ -37,18 +43,32 @@ const config = {
message: 'DO NOT DECLARE ENUM',
},
],
'unused-imports/no-unused-imports': 'error',
'import/prefer-default-export': 'off',
'import/extensions': [
/* typescript */
'@typescript-eslint/ban-ts-comment': [
'error',
'ignorePackages',
{
js: 'never',
jsx: 'never',
ts: 'never',
tsx: 'never',
'ts-expect-error': 'allow-with-description',
'ts-ignore': false,
'ts-nocheck': false,
'ts-check': false,
},
],
'@typescript-eslint/consistent-type-imports': [
'error',
{
prefer: 'type-imports',
},
],
'@typescript-eslint/no-unused-vars': [
'warn',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
},
],
/* react */
'react/jsx-filename-extension': ['error', { extensions: ['.jsx', '.tsx'] }],
'react/jsx-props-no-spreading': 'off',
'react/function-component-definition': [
Expand All @@ -62,15 +82,91 @@ const config = {
'react/jsx-uses-react': 'off',
'react/react-in-jsx-scope': 'off',
'react-hooks/exhaustive-deps': 'warn',
'@typescript-eslint/ban-ts-comment': [
/* import */
'unused-imports/no-unused-imports': 'error',
'import/prefer-default-export': 'off',
'import/extensions': [
'error',
'ignorePackages',
{
'ts-expect-error': 'allow-with-description',
'ts-ignore': false,
'ts-nocheck': false,
'ts-check': false,
js: 'never',
jsx: 'never',
ts: 'never',
tsx: 'never',
},
],
'import/order': [
'error',
{
'groups': ['builtin', 'external', 'parent', 'sibling', 'index', 'object', 'type'],
'pathGroupsExcludedImportTypes': ['builtin'],
'newlines-between': 'always',
'pathGroups': [
{
pattern: '{react,react-dom/**,react-router-dom}',
group: 'builtin',
position: 'before',
},
{
pattern: '@/app/**',
group: 'parent',
position: 'before',
},
{
pattern: '@/components/**',
group: 'parent',
position: 'before',
},
{
pattern: '@/stores/**',
group: 'parent',
position: 'before',
},
{
pattern: '@/providers/**',
group: 'parent',
position: 'before',
},
{
pattern: '@/hooks/**',
group: 'parent',
position: 'before',
},
{
pattern: '@/constants/**',
group: 'parent',
position: 'before',
},
{
pattern: '@/libs/**',
group: 'parent',
position: 'before',
},
{
pattern: '@/utils/**',
group: 'parent',
position: 'before',
},
{
pattern: '@/**',
group: 'parent',
position: 'before',
},
],
'alphabetize': {
order: 'asc',
},
},
],
/* tailwindcss */
'tailwindcss/no-custom-classname': [
'warn',
{
config: 'tailwind.config.cjs',
},
],
'tailwindcss/classnames-order': 'off',
/* jest */
'jest/consistent-test-it': ['error', { fn: 'it' }],
'jest/require-top-level-describe': ['error'],
},
Expand Down
5 changes: 5 additions & 0 deletions .markuplintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": [
"markuplint:recommended"
]
}
25 changes: 5 additions & 20 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,13 @@ const config = {
tabWidth: 2,
semi: true,
singleQuote: true,
jsxSingleQuote: true,
jsxSingleQuote: false,
bracketSameLine: true,
trailingComma: 'es5',
importOrder: [
'^(react/(.*)$)|^(react$)',
'^(next/(.*)$)|^(next$)',
'<THIRD_PARTY_MODULES>',
'',
'^types$',
'^@local/(.*)$',
'^@/config/(.*)$',
'^@/lib/(.*)$',
'^@/components/(.*)$',
'^@/styles/(.*)$',
'^[./]',
],
importOrderSeparation: false,
importOrderSortSpecifiers: true,
importOrderBuiltinModulesToTop: true,
importOrderParserPlugins: ['typescript', 'jsx', 'decorators-legacy'],
importOrderMergeDuplicateImports: true,
importOrderCombineTypeAndValueImports: true,
quoteProps: 'consistent',
bracketSpacing: true,
arrowParens: 'always',
plugins: [require('prettier-plugin-tailwindcss')],
};

module.exports = config;
7 changes: 6 additions & 1 deletion jest.setup.cjs
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
import '@testing-library/jest-dom';
// Optional: configure or set up a testing framework before each test.
// If you delete this file, remove `setupFilesAfterEnv` from `jest.config.js`

// Used for __tests__/testing-library.js
// Learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom/extend-expect';
Loading