-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: https://github.com/kufu/eslint-config-smarthr からファイルを移動 (#453)
- Loading branch information
Showing
22 changed files
with
4,529 additions
and
276 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# https://help.github.com/en/articles/about-code-owners | ||
|
||
* @kufu/group-dev-tamatebako-reviewers | ||
/packages/eslint-config-smarthr/ @kufu/group-dev-front-linter-reviewers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import smarthr from 'eslint-config-smarthr' | ||
|
||
export default [ | ||
...smarthr, | ||
{ | ||
rules: { | ||
'smarthr/require-barrel-import': 'off', // TODO: 要対応 | ||
'smarthr/best-practice-for-date': 'off', // TODO: 要対応 | ||
} | ||
}, | ||
{ | ||
files: ['packages/create-lint-set/**/*.ts'], | ||
rules: { | ||
'@typescript-eslint/no-require-imports': 'off', // TODO: 要対応 | ||
} | ||
}, | ||
{ | ||
ignores: ["packages/*/lib/*"], | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright 2024 SmartHR | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# eslint-config-smarthr | ||
|
||
[![npm version](https://badge.fury.io/js/eslint-config-smarthr.svg)](https://badge.fury.io/js/eslint-config-smarthr) | ||
|
||
|
||
A sharable ESLint config for SmartHR. | ||
This is intended to use at a project for React + TypeScript. | ||
|
||
## Install | ||
|
||
```sh | ||
pnpm add --dev eslint typescript react // install peerDependencies | ||
pnpm add --dev eslint-config-smarthr | ||
``` | ||
|
||
## How to use | ||
|
||
Add a following `eslint.config.mjs` in your project. | ||
|
||
```js | ||
import smarthr from 'eslint-config-smarthr' | ||
|
||
export default [ | ||
...smarthr, | ||
{ | ||
// your project's configuration | ||
}, | ||
] | ||
``` | ||
|
||
Run `eslint`! | ||
|
||
```sh | ||
pnpm eslint src | ||
``` | ||
|
||
If you want to lint TypeScript files including `.tsx`, you can use `--ext` option ESLint has. | ||
|
||
```sh | ||
pnpm eslint --ext .ts,.tsx src | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
import js from '@eslint/js' | ||
import * as importPlugin from 'eslint-plugin-import' | ||
|
||
/** | ||
* @type {import('eslint').Linter.Config} | ||
*/ | ||
export default [ | ||
{ | ||
name: 'eslint-config-smarthr/eslint', | ||
plugins: { | ||
'import': importPlugin, | ||
}, | ||
languageOptions: { | ||
parserOptions: { | ||
ecmaVersion: 2018, | ||
sourceType: 'module', | ||
} | ||
}, | ||
rules: { | ||
...js.configs.recommended.rules, | ||
'array-callback-return': 'warn', | ||
'arrow-body-style': ['error', 'as-needed'], | ||
'block-scoped-var': 'warn', | ||
curly: ['warn', 'multi-line'], | ||
'default-param-last': 'error', | ||
'dot-notation': 'error', | ||
eqeqeq: 'error', | ||
'import/no-duplicates': 'error', | ||
'import/no-useless-path-segments': 'error', | ||
'import/order': [ | ||
'error', | ||
{ | ||
groups: ['builtin', 'external', 'parent', 'sibling', 'index', 'object', 'type'], | ||
pathGroups: [ | ||
{ | ||
pattern: '@/**', | ||
group: 'parent', | ||
position: 'before', | ||
}, | ||
], | ||
alphabetize: { | ||
order: 'asc', | ||
}, | ||
'newlines-between': 'always', | ||
}, | ||
], | ||
'no-async-promise-executor': 'error', | ||
'no-caller': 'error', | ||
'no-catch-shadow': 'error', | ||
'no-confusing-arrow': [ | ||
'error', | ||
{ | ||
allowParens: true, | ||
}, | ||
], | ||
'no-div-regex': 'warn', | ||
'no-eval': 'error', | ||
'no-extend-native': 'error', | ||
'no-extra-parens': ['error', 'functions'], | ||
'no-floating-decimal': 'error', | ||
'no-implicit-globals': 'error', | ||
'no-implied-eval': 'error', | ||
'no-import-assign': 'error', | ||
'no-inner-declarations': 'warn', | ||
'no-iterator': 'error', | ||
'no-label-var': 'error', | ||
'no-lone-blocks': 'error', | ||
'no-loop-func': 'warn', | ||
'no-new-func': 'error', | ||
'no-new-wrappers': 'error', | ||
'no-octal-escape': 'error', | ||
'no-proto': 'error', | ||
'no-return-assign': 'error', | ||
'no-return-await': 'error', | ||
'no-script-url': 'warn', | ||
'no-self-compare': 'error', | ||
'no-sequences': 'error', | ||
'no-shadow': 'error', | ||
'no-shadow-restricted-names': 'error', | ||
'no-throw-literal': 'error', | ||
'no-unmodified-loop-condition': 'warn', | ||
'no-unused-expressions': [ | ||
'error', | ||
{ | ||
allowShortCircuit: true, | ||
allowTernary: true, | ||
}, | ||
], | ||
'no-unused-vars': [ | ||
'error', | ||
{ | ||
vars: 'local', | ||
args: 'none', | ||
}, | ||
], | ||
'no-useless-call': 'warn', | ||
'no-useless-computed-key': 'error', | ||
'no-useless-concat': 'error', | ||
'no-useless-rename': 'error', | ||
'no-var': 'error', | ||
'no-void': 'error', | ||
'no-with': 'error', | ||
'object-shorthand': ['error', 'properties'], | ||
'prefer-arrow-callback': 'warn', | ||
'prefer-const': [ | ||
'warn', | ||
{ | ||
destructuring: 'all', | ||
ignoreReadBeforeAssign: true, | ||
}, | ||
], | ||
'prefer-numeric-literals': 'error', | ||
'prefer-regex-literals': 'error', | ||
'prefer-rest-params': 'error', | ||
'prefer-spread': 'warn', | ||
radix: 'error', | ||
'sort-imports': [ | ||
'error', | ||
{ | ||
ignoreDeclarationSort: true, | ||
}, | ||
], | ||
'symbol-description': 'error', | ||
'template-curly-spacing': 'error', | ||
'valid-typeof': [ | ||
'error', | ||
{ | ||
requireStringLiterals: true, | ||
}, | ||
], | ||
'vars-on-top': 'warn', | ||
'wrap-iife': ['error', 'any'], | ||
'yield-star-spacing': ['error', 'after'], | ||
}, | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import Prettier from 'eslint-config-prettier' | ||
|
||
/** | ||
* @type {import('eslint').Linter.Config} | ||
*/ | ||
export default [ | ||
{ | ||
name: 'eslint-config-smarthr/prettier', | ||
rules: { | ||
...Prettier.rules, | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
import pluginReact from 'eslint-plugin-react' | ||
import pluginReactHooks from 'eslint-plugin-react-hooks' | ||
import pluginJsxA11y from 'eslint-plugin-jsx-a11y' | ||
|
||
/** | ||
* @type {import('eslint').Linter.Config} | ||
*/ | ||
export default [ | ||
{ | ||
name: 'eslint-plugin-react', | ||
...pluginReact.configs.flat.recommended, | ||
}, | ||
{ | ||
name: 'eslint-config-smarthr/react', | ||
plugins: { | ||
react: pluginReact, | ||
'react-hooks': pluginReactHooks, | ||
'jsx-a11y': pluginJsxA11y | ||
}, | ||
languageOptions: { | ||
parserOptions: { | ||
ecmaFeatures: { | ||
jax: true, | ||
}, | ||
}, | ||
}, | ||
settings: { | ||
react: { | ||
version: 'detect', | ||
}, | ||
}, | ||
rules: { | ||
'jsx-a11y/alt-text': 'warn', | ||
'jsx-a11y/anchor-has-content': 'warn', | ||
// 'jsx-a11y/anchor-is-valid': 'warn', | ||
'jsx-a11y/aria-activedescendant-has-tabindex': 'warn', | ||
'jsx-a11y/aria-props': 'warn', | ||
'jsx-a11y/aria-role': 'warn', | ||
'jsx-a11y/aria-unsupported-elements': 'warn', | ||
// 'jsx-a11y/click-events-have-key-events': 'warn', | ||
'jsx-a11y/heading-has-content': 'warn', | ||
'jsx-a11y/html-has-lang': 'error', | ||
'jsx-a11y/iframe-has-title': 'warn', | ||
'jsx-a11y/interactive-supports-focus': 'warn', | ||
'jsx-a11y/label-has-associated-control': 'warn', | ||
'jsx-a11y/lang': 'error', | ||
'jsx-a11y/media-has-caption': 'warn', | ||
'jsx-a11y/mouse-events-have-key-events': 'warn', | ||
'jsx-a11y/no-access-key': 'warn', | ||
'jsx-a11y/no-autofocus': 'warn', | ||
'jsx-a11y/no-distracting-elements': 'warn', | ||
'jsx-a11y/no-interactive-element-to-noninteractive-role': 'warn', | ||
'jsx-a11y/no-noninteractive-element-interactions': 'warn', | ||
'jsx-a11y/no-noninteractive-element-to-interactive-role': 'warn', | ||
'jsx-a11y/no-noninteractive-tabindex': 'warn', | ||
'jsx-a11y/no-redundant-roles': 'warn', | ||
// 'jsx-a11y/no-static-element-interactions': 'warn', | ||
'jsx-a11y/role-has-required-aria-props': 'warn', | ||
'jsx-a11y/role-supports-aria-props': 'warn', | ||
'jsx-a11y/scope': 'warn', | ||
'jsx-a11y/tabindex-no-positive': 'warn', | ||
'jsx-quotes': 'error', | ||
'react-hooks/exhaustive-deps': 'warn', | ||
'react-hooks/rules-of-hooks': 'error', | ||
'react/display-name': 'off', | ||
'react/jsx-curly-brace-presence': 'off', | ||
'react/jsx-filename-extension': ['error', { extensions: ['.tsx', '.jsx'] }], | ||
'react/jsx-fragments': ['error', 'syntax'], | ||
'react/jsx-no-useless-fragment': 'error', | ||
'react/jsx-pascal-case': ['warn', { allowAllCaps: true }], | ||
'react/no-access-state-in-setstate': 'error', | ||
'react/no-children-prop': 'warn', | ||
'react/no-did-mount-set-state': 'error', | ||
'react/no-did-update-set-state': 'error', | ||
'react/no-redundant-should-component-update': 'error', | ||
'react/no-this-in-sfc': 'error', | ||
'react/no-typos': 'error', | ||
'react/no-unescaped-entities': 'warn', | ||
'react/no-will-update-set-state': 'error', | ||
'react/prefer-es6-class': 'error', | ||
'react/prefer-stateless-function': ['error', { ignorePureComponents: true }], | ||
'react/prop-types': 'off', | ||
'react/style-prop-object': 'error', | ||
'react/void-dom-elements-no-children': 'error', | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import typeScriptEslint from 'typescript-eslint' | ||
import globals from 'globals' | ||
|
||
/** | ||
* @type {import('eslint').Linter.Config} | ||
*/ | ||
export default [ | ||
...typeScriptEslint.configs.recommended, | ||
{ | ||
name: 'eslint-config-smarthr/typescript', | ||
plugins: { | ||
typescript: typeScriptEslint.plugin | ||
}, | ||
languageOptions: { | ||
parser: typeScriptEslint.parser, | ||
globals: { | ||
...globals.browser, | ||
...globals.es2015, | ||
...globals.commonjs, | ||
} | ||
}, | ||
rules: { | ||
'@typescript-eslint/array-type': ['error', { default: 'array-simple' }], | ||
'@typescript-eslint/ban-ts-comment': 'off', | ||
'@typescript-eslint/explicit-member-accessibility': 'off', | ||
'@typescript-eslint/explicit-module-boundary-types': 'off', | ||
'@typescript-eslint/no-empty-interface': 'off', | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
'@typescript-eslint/no-inferrable-types': 'off', | ||
'@typescript-eslint/no-non-null-assertion': 'off', | ||
'@typescript-eslint/no-object-literal-type-assertion': 'off', | ||
'@typescript-eslint/no-triple-slash-reference': 'off', | ||
'@typescript-eslint/no-unused-vars': 'off', | ||
'@typescript-eslint/no-var-requires': 'off', | ||
'@typescript-eslint/prefer-interface': 'off', | ||
'@typescript-eslint/prefer-namespace-keyword': 'off', | ||
'@typescript-eslint/unified-signatures': 'warn', | ||
'no-useless-constructor': 'off', | ||
} | ||
} | ||
] |
Oops, something went wrong.