Skip to content

Commit

Permalink
chore: https://github.com/kufu/eslint-config-smarthr からファイルを移動 (#453)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tokky0425 authored Dec 17, 2024
1 parent 8d83ad4 commit 979e93d
Show file tree
Hide file tree
Showing 22 changed files with 4,529 additions and 276 deletions.
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

8 changes: 0 additions & 8 deletions .eslintrc.js

This file was deleted.

1 change: 1 addition & 0 deletions .github/CODEOWNERS
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
1 change: 1 addition & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"packages/create-lint-set": "1.1.5",
"packages/eslint-config-smarthr": "8.0.0",
"packages/next-auth": "0.1.5",
"packages/prettier-config-smarthr": "1.0.1",
"packages/stylelint-config-smarthr": "3.0.2",
Expand Down
20 changes: 20 additions & 0 deletions eslint.config.mjs
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/*"],
}
]
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@
"@commitlint/cli": "^19.5.0",
"@commitlint/config-conventional": "^19.5.0",
"@types/jest": "^29.5.12",
"eslint": "^8.57.0",
"eslint-config-smarthr": "^6.33.2",
"eslint": "^9.15.0",
"eslint-config-smarthr": "8.0.0",
"husky": "^9.1.7",
"jest": "^29.7.0",
"lerna": "^8.1.9",
"prettier": "^3.3.3",
"prettier-config-smarthr": "^1.0.0",
"react": "^19.0.0",
"rimraf": "^5.0.10",
"ts-jest": "^29.2.5",
"typescript": "^5.6.3"
Expand Down
507 changes: 507 additions & 0 deletions packages/eslint-config-smarthr/CHANGELOG.md

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions packages/eslint-config-smarthr/LICENSE
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.
41 changes: 41 additions & 0 deletions packages/eslint-config-smarthr/README.md
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
```
136 changes: 136 additions & 0 deletions packages/eslint-config-smarthr/configs/eslint.js
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'],
},
}
]
13 changes: 13 additions & 0 deletions packages/eslint-config-smarthr/configs/prettier.js
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,
}
}
]
87 changes: 87 additions & 0 deletions packages/eslint-config-smarthr/configs/react.js
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',
}
}
]
41 changes: 41 additions & 0 deletions packages/eslint-config-smarthr/configs/typescript.js
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',
}
}
]
Loading

0 comments on commit 979e93d

Please sign in to comment.