@slashnephy/eslint-config 3.0.105 → 3.0.110

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,128 +0,0 @@
1
- // @ts-expect-error 型定義ファイルがない
2
- import jsxA11y from 'eslint-plugin-jsx-a11y';
3
- import reactPlugin from 'eslint-plugin-react';
4
- import reactHooksPlugin from 'eslint-plugin-react-hooks';
5
- import reactRefreshPlugin from 'eslint-plugin-react-refresh';
6
- import globals from 'globals';
7
- import { config } from 'typescript-eslint';
8
- export const react = config([
9
- {
10
- name: 'eslint-plugin-react',
11
- files: ['**/*.{jsx,tsx}'],
12
- extends: [
13
- reactPlugin.configs.flat.recommended,
14
- reactPlugin.configs.flat['jsx-runtime'],
15
- ],
16
- languageOptions: {
17
- parserOptions: {
18
- ecmaFeatures: {
19
- jsx: true,
20
- },
21
- lib: ['dom'],
22
- },
23
- globals: globals.browser,
24
- },
25
- settings: {
26
- react: {
27
- version: 'detect',
28
- },
29
- },
30
- rules: {
31
- // <div flag={true} /> 👉 <div flag />
32
- 'react/jsx-boolean-value': 'error',
33
- // <div value={'test'} /> 👉 <div value='test' />
34
- 'react/jsx-curly-brace-presence': 'error',
35
- // <div></div> 👉 <div />
36
- 'react/self-closing-comp': [
37
- 'error',
38
- {
39
- component: true,
40
- html: true,
41
- },
42
- ],
43
- // コンポーネント名を PascalCase に強制
44
- 'react/jsx-pascal-case': 'error',
45
- // ハンドラーの名前規則
46
- 'react/jsx-handler-names': 'error',
47
- // useState の分解宣言 & setXXX という名前を強制
48
- 'react/hook-use-state': 'error',
49
- // <React.Fragment /> 👉 </>
50
- 'react/jsx-fragments': 'error',
51
- // ステートレス関数を優先
52
- 'react/prefer-stateless-function': 'error',
53
- // props を並び替える
54
- 'react/jsx-sort-props': [
55
- 'error',
56
- {
57
- callbacksLast: true,
58
- shorthandFirst: true,
59
- multiline: 'last',
60
- reservedFirst: true,
61
- },
62
- ],
63
- // JSX を .tsx でも使えるように
64
- 'react/jsx-filename-extension': [
65
- 'error',
66
- {
67
- extensions: ['.jsx', '.tsx'],
68
- },
69
- ],
70
- // props に対してスプレッド演算子を使えるように
71
- 'react/jsx-props-no-spreading': 'off',
72
- // <></> を使えるように
73
- 'react/jsx-no-useless-fragment': 'off',
74
- // defaultProps を使わない
75
- 'react/require-default-props': 'off',
76
- // useCallback でコールバックを宣言させる
77
- 'react/jsx-no-bind': 'warn',
78
- // コンポーネントの宣言を function Component() {} に強制
79
- 'react/function-component-definition': [
80
- 'error',
81
- {
82
- namedComponents: 'function-declaration',
83
- unnamedComponents: 'arrow-function',
84
- },
85
- ],
86
- },
87
- },
88
- {
89
- name: 'eslint-plugin-react',
90
- files: ['**/*.jsx'],
91
- rules: {
92
- 'react/prop-types': 'error',
93
- },
94
- },
95
- ], {
96
- name: 'eslint-plugin-react-hooks',
97
- files: ['**/*.{jsx,tsx}'],
98
- extends: [reactHooksPlugin.configs['recommended-latest']],
99
- rules: {
100
- // https://recoiljs.org/docs/introduction/installation/#eslint
101
- 'react-hooks/rules-of-hooks': 'error',
102
- 'react-hooks/exhaustive-deps': [
103
- 'warn',
104
- {
105
- additionalHooks: '(useRecoilCallback|useRecoilTransaction_UNSTABLE)',
106
- },
107
- ],
108
- },
109
- }, {
110
- name: 'eslint-plugin-jsx-a11y',
111
- files: ['**/*.{jsx,tsx}'],
112
- extends: [jsxA11y.flatConfigs.recommended],
113
- rules: {
114
- 'jsx-a11y/alt-text': [
115
- 'warn',
116
- {
117
- elements: ['img', 'object', 'area'],
118
- img: ['Image'],
119
- object: [],
120
- area: [],
121
- },
122
- ],
123
- },
124
- }, {
125
- name: 'eslint-plugin-react-refresh',
126
- files: ['**/*.{jsx,tsx}'],
127
- extends: [reactRefreshPlugin.configs.recommended],
128
- });
@@ -1,13 +0,0 @@
1
- import { config } from 'typescript-eslint';
2
- export const relay = config({
3
- name: 'eslint-plugin-relay',
4
- files: ['**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}'],
5
- // TODO: eslint-plugin-relay が Flat Configs に対応したら移行する
6
- // https://github.com/relayjs/eslint-plugin-relay/issues/156
7
- // extends: ['plugin:relay/recommended'],
8
- // plugins: ['relay'],
9
- // rules: {
10
- // // 未使用の GraphQL フィールドを禁止
11
- // 'relay/unused-fields': 'error',
12
- // },
13
- });
@@ -1,7 +0,0 @@
1
- import storybookPlugin from 'eslint-plugin-storybook';
2
- import { config } from 'typescript-eslint';
3
- export const storybook = config({
4
- name: 'eslint-plugin-storybook',
5
- files: ['**/*.stories.{jsx,tsx}'],
6
- extends: [storybookPlugin.configs['flat/recommended']],
7
- });
@@ -1,7 +0,0 @@
1
- import reactRefreshPlugin from 'eslint-plugin-react-refresh';
2
- import { config } from 'typescript-eslint';
3
- export const vite = config({
4
- name: 'eslint-plugin-react-refresh',
5
- files: ['**/src/**/*.{jsx,tsx}'],
6
- extends: [reactRefreshPlugin.configs.vite],
7
- });
@@ -1,20 +0,0 @@
1
- import vitestPlugin from '@vitest/eslint-plugin';
2
- import { config } from 'typescript-eslint';
3
- export const vitest = config({
4
- name: '@vitest/eslint-plugin',
5
- files: [
6
- '**/*.test.{js,cjs,mjs,jsx,ts,cts,mts,tsx}',
7
- '**/test/**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}',
8
- ],
9
- extends: [vitestPlugin.configs.recommended],
10
- settings: {
11
- vitest: {
12
- typecheck: true,
13
- },
14
- },
15
- languageOptions: {
16
- globals: {
17
- ...vitestPlugin.environments.env.globals,
18
- },
19
- },
20
- });
package/src/index.js DELETED
@@ -1,60 +0,0 @@
1
- import tseslint from 'typescript-eslint';
2
- import { common } from './base/common.js';
3
- import { graphql } from './base/graphql.js';
4
- import { javaScript } from './base/javascript.js';
5
- import { packageJson } from './base/package.json.js';
6
- import { typeScript } from './base/typescript.js';
7
- import { yaml } from './base/yaml.js';
8
- import { cloudflareWorkers } from './environments/cloudflareWorkers.js';
9
- import { node } from './environments/node.js';
10
- import { userScript } from './environments/userscript.js';
11
- import { jest } from './frameworks/jest.js';
12
- import { nextJs } from './frameworks/next.js.js';
13
- import { react } from './frameworks/react.js';
14
- import { relay } from './frameworks/relay.js';
15
- import { storybook } from './frameworks/storybook.js';
16
- import { vite } from './frameworks/vite.js';
17
- import { vitest } from './frameworks/vitest.js';
18
- export function config(_options, ...overrides) {
19
- return tseslint.config(
20
- // ベース
21
- [
22
- common,
23
- // JavaScript
24
- javaScript,
25
- // TypeScript
26
- typeScript,
27
- // GraphQL
28
- graphql,
29
- // YAML
30
- yaml,
31
- // package.json
32
- packageJson,
33
- ],
34
- // フレームワーク
35
- [
36
- // React
37
- react,
38
- // Next.js
39
- nextJs,
40
- // Vite
41
- vite,
42
- // Relay
43
- relay,
44
- // Storybook
45
- storybook,
46
- // Jest
47
- jest,
48
- // Vitest
49
- vitest,
50
- ],
51
- // 環境
52
- [
53
- // Node.js
54
- node,
55
- // Cloudflare Worker
56
- cloudflareWorkers,
57
- // UserScript
58
- userScript,
59
- ], ...overrides);
60
- }