@typeform/eslint-config 6.1.0 → 6.2.0-beta.1
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.
- package/.github/workflows/deploy.yml +6 -3
- package/.github/workflows/tests.yml +13 -1
- package/.husky/pre-commit +12 -0
- package/README.md +33 -14
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +153 -0
- package/eslint.config.js +1 -0
- package/index.test.js +18 -22
- package/index.ts +172 -0
- package/jest.config.js +4 -1
- package/package.json +41 -40
- package/tsconfig.json +29 -0
- package/types.d.ts +2 -0
- package/.eslintignore +0 -1
- package/.eslintrc +0 -3
- package/index.js +0 -62
- /package/prettier/{index.js → index.cjs} +0 -0
|
@@ -15,12 +15,12 @@ jobs:
|
|
|
15
15
|
|
|
16
16
|
steps:
|
|
17
17
|
- name: Check out Git repository
|
|
18
|
-
uses: actions/checkout@
|
|
18
|
+
uses: actions/checkout@v5
|
|
19
19
|
|
|
20
20
|
- name: Set up Node.js
|
|
21
21
|
uses: actions/setup-node@v4
|
|
22
22
|
with:
|
|
23
|
-
node-version:
|
|
23
|
+
node-version: 22
|
|
24
24
|
|
|
25
25
|
- name: Set GitHub packages registry
|
|
26
26
|
run: |
|
|
@@ -38,10 +38,13 @@ jobs:
|
|
|
38
38
|
if: steps.yarn-cache.outputs.cache-hit != 'true'
|
|
39
39
|
run: yarn install --frozen-lockfile
|
|
40
40
|
|
|
41
|
+
- name: Build
|
|
42
|
+
run: yarn build
|
|
43
|
+
|
|
41
44
|
- name: Run linting
|
|
42
45
|
run: yarn lint
|
|
43
46
|
|
|
44
|
-
- name: Release
|
|
47
|
+
- name: Release
|
|
45
48
|
run: yarn semantic-release
|
|
46
49
|
env:
|
|
47
50
|
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
|
@@ -11,18 +11,30 @@ on:
|
|
|
11
11
|
jobs:
|
|
12
12
|
tests:
|
|
13
13
|
runs-on: [ubuntu-latest]
|
|
14
|
+
strategy:
|
|
15
|
+
matrix:
|
|
16
|
+
node-version: [20, 22]
|
|
17
|
+
fail-fast: false
|
|
14
18
|
|
|
15
19
|
steps:
|
|
16
20
|
- name: Check Out Source Code
|
|
17
|
-
uses: actions/checkout@
|
|
21
|
+
uses: actions/checkout@v5
|
|
18
22
|
with:
|
|
19
23
|
fetch-depth: 0
|
|
20
24
|
|
|
25
|
+
- name: Set up Node.js
|
|
26
|
+
uses: actions/setup-node@v5
|
|
27
|
+
with:
|
|
28
|
+
node-version: ${{ matrix.node-version }}
|
|
29
|
+
|
|
21
30
|
- name: Set up
|
|
22
31
|
run: yarn
|
|
23
32
|
|
|
24
33
|
- name: Lint
|
|
25
34
|
run: yarn lint
|
|
26
35
|
|
|
36
|
+
- name: Build
|
|
37
|
+
run: yarn build
|
|
38
|
+
|
|
27
39
|
- name: Test
|
|
28
40
|
run: yarn test
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
|
|
3
|
+
# Try to use node from PATH first
|
|
4
|
+
if ! command -v node >/dev/null 2>&1; then
|
|
5
|
+
# If node is not found, try to load nvm
|
|
6
|
+
if [ -f ~/.nvm/nvm.sh ]; then
|
|
7
|
+
. ~/.nvm/nvm.sh
|
|
8
|
+
nvm use 22 >/dev/null 2>&1 || nvm use default >/dev/null 2>&1
|
|
9
|
+
fi
|
|
10
|
+
fi
|
|
11
|
+
|
|
12
|
+
yarn lint-staged
|
package/README.md
CHANGED
|
@@ -11,12 +11,27 @@ yarn add eslint @typeform/eslint-config --dev
|
|
|
11
11
|
|
|
12
12
|
## Usage
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
This package uses ESLint's flat config format. Create an `eslint.config.js` file with the following content:
|
|
15
15
|
|
|
16
16
|
```js
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
import typeformConfig from '@typeform/eslint-config'
|
|
18
|
+
|
|
19
|
+
export default typeformConfig
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Or extend it with your own rules:
|
|
23
|
+
|
|
24
|
+
```js
|
|
25
|
+
import typeformConfig from '@typeform/eslint-config'
|
|
26
|
+
|
|
27
|
+
export default [
|
|
28
|
+
...typeformConfig,
|
|
29
|
+
{
|
|
30
|
+
rules: {
|
|
31
|
+
// Your custom rules
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
]
|
|
20
35
|
```
|
|
21
36
|
|
|
22
37
|
And run with:
|
|
@@ -25,18 +40,22 @@ And run with:
|
|
|
25
40
|
yarn eslint . --fix
|
|
26
41
|
```
|
|
27
42
|
|
|
28
|
-
##
|
|
43
|
+
## Development
|
|
29
44
|
|
|
30
|
-
|
|
45
|
+
This package is written in TypeScript and requires building before use:
|
|
31
46
|
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
```
|
|
47
|
+
```sh
|
|
48
|
+
# Install dependencies
|
|
49
|
+
yarn install
|
|
37
50
|
|
|
38
|
-
|
|
51
|
+
# Build TypeScript
|
|
52
|
+
yarn build
|
|
39
53
|
|
|
40
|
-
|
|
41
|
-
yarn
|
|
54
|
+
# Run tests
|
|
55
|
+
yarn test
|
|
56
|
+
|
|
57
|
+
# Lint
|
|
58
|
+
yarn lint
|
|
42
59
|
```
|
|
60
|
+
|
|
61
|
+
The `prepare` script automatically builds the package after `yarn install`.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";AAUA,wBAiKC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import tseslint from 'typescript-eslint';
|
|
2
|
+
import reactPlugin from 'eslint-plugin-react';
|
|
3
|
+
import reactHooksPlugin from 'eslint-plugin-react-hooks';
|
|
4
|
+
import jsxA11yPlugin from 'eslint-plugin-jsx-a11y';
|
|
5
|
+
import jestPlugin from 'eslint-plugin-jest';
|
|
6
|
+
import importPlugin from 'eslint-plugin-import';
|
|
7
|
+
import prettierConfig from 'eslint-config-prettier';
|
|
8
|
+
import globals from 'globals';
|
|
9
|
+
export default [
|
|
10
|
+
// Ignore test-cases directory (these files intentionally have errors for testing)
|
|
11
|
+
// Ignore dist directory (generated TypeScript output)
|
|
12
|
+
{
|
|
13
|
+
ignores: ['dist/**', 'test-cases/**'],
|
|
14
|
+
},
|
|
15
|
+
// Base recommended configs (only jsx-a11y and prettier, not eslint:recommended to match original behavior)
|
|
16
|
+
jsxA11yPlugin.flatConfigs.recommended,
|
|
17
|
+
prettierConfig,
|
|
18
|
+
// JavaScript/JSX configuration
|
|
19
|
+
{
|
|
20
|
+
files: ['**/*.{js,mjs,cjs,jsx}'],
|
|
21
|
+
plugins: {
|
|
22
|
+
'react': reactPlugin,
|
|
23
|
+
'react-hooks': reactHooksPlugin,
|
|
24
|
+
'jest': jestPlugin,
|
|
25
|
+
'import': importPlugin,
|
|
26
|
+
},
|
|
27
|
+
languageOptions: {
|
|
28
|
+
ecmaVersion: 'latest',
|
|
29
|
+
sourceType: 'module',
|
|
30
|
+
parserOptions: {
|
|
31
|
+
ecmaFeatures: {
|
|
32
|
+
jsx: true,
|
|
33
|
+
generators: true,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
globals: {
|
|
37
|
+
...globals.browser,
|
|
38
|
+
...globals.node,
|
|
39
|
+
...globals.commonjs,
|
|
40
|
+
...globals.es2021,
|
|
41
|
+
...globals.jest,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
settings: {
|
|
45
|
+
react: {
|
|
46
|
+
version: 'detect',
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
rules: {
|
|
50
|
+
'no-var': 'warn',
|
|
51
|
+
'curly': 'warn',
|
|
52
|
+
'prefer-destructuring': 'warn',
|
|
53
|
+
'import/order': [
|
|
54
|
+
'warn',
|
|
55
|
+
{
|
|
56
|
+
'newlines-between': 'always',
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
'import/export': 'warn',
|
|
60
|
+
'jest/no-focused-tests': 'error',
|
|
61
|
+
'no-console': 'warn',
|
|
62
|
+
'no-debugger': 'error',
|
|
63
|
+
'prefer-template': 'warn',
|
|
64
|
+
'react/prop-types': 'error',
|
|
65
|
+
'react-hooks/exhaustive-deps': 'error',
|
|
66
|
+
'react/jsx-key': ['warn', { checkFragmentShorthand: true }],
|
|
67
|
+
'no-restricted-imports': [
|
|
68
|
+
'warn',
|
|
69
|
+
{
|
|
70
|
+
patterns: [
|
|
71
|
+
{
|
|
72
|
+
group: ['@typeform/kitt/lib/*'],
|
|
73
|
+
message: "🙈 The lib notation is deprecated. Refer to the Kitt's doc, and ping the FEAR team if you have a doubt",
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
// TypeScript configuration
|
|
81
|
+
{
|
|
82
|
+
files: ['**/*.{ts,tsx}'],
|
|
83
|
+
plugins: {
|
|
84
|
+
'@typescript-eslint': tseslint.plugin,
|
|
85
|
+
'react': reactPlugin,
|
|
86
|
+
'react-hooks': reactHooksPlugin,
|
|
87
|
+
'jest': jestPlugin,
|
|
88
|
+
'import': importPlugin,
|
|
89
|
+
},
|
|
90
|
+
languageOptions: {
|
|
91
|
+
ecmaVersion: 'latest',
|
|
92
|
+
sourceType: 'module',
|
|
93
|
+
parser: tseslint.parser,
|
|
94
|
+
parserOptions: {
|
|
95
|
+
ecmaFeatures: {
|
|
96
|
+
jsx: true,
|
|
97
|
+
generators: true,
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
globals: {
|
|
101
|
+
...globals.browser,
|
|
102
|
+
...globals.node,
|
|
103
|
+
...globals.commonjs,
|
|
104
|
+
...globals.es2021,
|
|
105
|
+
...globals.jest,
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
settings: {
|
|
109
|
+
react: {
|
|
110
|
+
version: 'detect',
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
rules: {
|
|
114
|
+
'no-var': 'warn',
|
|
115
|
+
'curly': 'warn',
|
|
116
|
+
'prefer-destructuring': 'warn',
|
|
117
|
+
'@typescript-eslint/no-extra-semi': 'off',
|
|
118
|
+
'import/order': [
|
|
119
|
+
'warn',
|
|
120
|
+
{
|
|
121
|
+
'newlines-between': 'always',
|
|
122
|
+
},
|
|
123
|
+
],
|
|
124
|
+
'import/export': 'warn',
|
|
125
|
+
'jest/no-focused-tests': 'error',
|
|
126
|
+
'no-console': 'warn',
|
|
127
|
+
'no-debugger': 'error',
|
|
128
|
+
'prefer-template': 'warn',
|
|
129
|
+
'react/prop-types': 'error',
|
|
130
|
+
'react-hooks/exhaustive-deps': 'error',
|
|
131
|
+
'react/jsx-key': ['warn', { checkFragmentShorthand: true }],
|
|
132
|
+
'@typescript-eslint/no-explicit-any': 'warn',
|
|
133
|
+
'@typescript-eslint/consistent-type-imports': [
|
|
134
|
+
'warn',
|
|
135
|
+
{
|
|
136
|
+
prefer: 'type-imports',
|
|
137
|
+
fixStyle: 'inline-type-imports',
|
|
138
|
+
},
|
|
139
|
+
],
|
|
140
|
+
'no-restricted-imports': [
|
|
141
|
+
'warn',
|
|
142
|
+
{
|
|
143
|
+
patterns: [
|
|
144
|
+
{
|
|
145
|
+
group: ['@typeform/kitt/lib/*'],
|
|
146
|
+
message: "🙈 The lib notation is deprecated. Refer to the Kitt's doc, and ping the FEAR team if you have a doubt",
|
|
147
|
+
},
|
|
148
|
+
],
|
|
149
|
+
},
|
|
150
|
+
],
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
];
|
package/eslint.config.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './dist/index.js'
|
package/index.test.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import { execSync } from 'child_process'
|
|
2
2
|
|
|
3
3
|
describe('eslint config', () => {
|
|
4
4
|
// #region Pass
|
|
5
5
|
it('should pass if there are no errors', () => {
|
|
6
|
-
const output =
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
const output = execSync(
|
|
7
|
+
'yarn eslint -f "json" --no-ignore test-cases/pass.js',
|
|
8
|
+
).toString()
|
|
9
9
|
expect(output.includes('"errorCount":0')).toBeTruthy()
|
|
10
10
|
expect(output.includes('"fatalErrorCount":0')).toBeTruthy()
|
|
11
11
|
expect(output.includes('"warningCount":0')).toBeTruthy()
|
|
@@ -16,11 +16,9 @@ describe('eslint config', () => {
|
|
|
16
16
|
|
|
17
17
|
// #region Warn
|
|
18
18
|
it('should warn if console is used', () => {
|
|
19
|
-
const output =
|
|
20
|
-
.
|
|
21
|
-
|
|
22
|
-
)
|
|
23
|
-
.toString()
|
|
19
|
+
const output = execSync(
|
|
20
|
+
'yarn eslint -f "json" --no-ignore test-cases/warn-no-console.js',
|
|
21
|
+
).toString()
|
|
24
22
|
|
|
25
23
|
expect(output.includes('"ruleId":"no-console"')).toBeTruthy()
|
|
26
24
|
expect(output.includes('"errorCount":0')).toBeTruthy()
|
|
@@ -28,9 +26,9 @@ describe('eslint config', () => {
|
|
|
28
26
|
})
|
|
29
27
|
|
|
30
28
|
it('should warn if var is used', () => {
|
|
31
|
-
const output =
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
const output = execSync(
|
|
30
|
+
'yarn eslint -f "json" --no-ignore test-cases/warn-no-var.js',
|
|
31
|
+
).toString()
|
|
34
32
|
|
|
35
33
|
expect(output.includes('"ruleId":"no-var"')).toBeTruthy()
|
|
36
34
|
expect(output.includes('"errorCount":0')).toBeTruthy()
|
|
@@ -38,9 +36,9 @@ describe('eslint config', () => {
|
|
|
38
36
|
})
|
|
39
37
|
|
|
40
38
|
it('should warn if braces are not used', () => {
|
|
41
|
-
const output =
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
const output = execSync(
|
|
40
|
+
'yarn eslint -f "json" --no-ignore test-cases/warn-curly.js',
|
|
41
|
+
).toString()
|
|
44
42
|
|
|
45
43
|
expect(output.includes('"ruleId":"curly"')).toBeTruthy()
|
|
46
44
|
expect(output.includes('"errorCount":0')).toBeTruthy()
|
|
@@ -48,11 +46,9 @@ describe('eslint config', () => {
|
|
|
48
46
|
})
|
|
49
47
|
|
|
50
48
|
it('should warn if destructuring is not used', () => {
|
|
51
|
-
const output =
|
|
52
|
-
.
|
|
53
|
-
|
|
54
|
-
)
|
|
55
|
-
.toString()
|
|
49
|
+
const output = execSync(
|
|
50
|
+
'yarn eslint -f "json" --no-ignore test-cases/warn-prefer-destructuring.js',
|
|
51
|
+
).toString()
|
|
56
52
|
|
|
57
53
|
expect(output.includes('"ruleId":"prefer-destructuring"')).toBeTruthy()
|
|
58
54
|
expect(output.includes('"errorCount":0')).toBeTruthy()
|
|
@@ -63,8 +59,8 @@ describe('eslint config', () => {
|
|
|
63
59
|
// #region Fail
|
|
64
60
|
it('should fail if debugger is used', () => {
|
|
65
61
|
const call = () =>
|
|
66
|
-
|
|
67
|
-
'yarn eslint -f "json" --no-ignore test-cases/error-no-debugger.js'
|
|
62
|
+
execSync(
|
|
63
|
+
'yarn eslint -f "json" --no-ignore test-cases/error-no-debugger.js',
|
|
68
64
|
)
|
|
69
65
|
|
|
70
66
|
expect(call).toThrow()
|
package/index.ts
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import js from '@eslint/js'
|
|
2
|
+
import tseslint from 'typescript-eslint'
|
|
3
|
+
import reactPlugin from 'eslint-plugin-react'
|
|
4
|
+
import reactHooksPlugin from 'eslint-plugin-react-hooks'
|
|
5
|
+
import jsxA11yPlugin from 'eslint-plugin-jsx-a11y'
|
|
6
|
+
import jestPlugin from 'eslint-plugin-jest'
|
|
7
|
+
import importPlugin from 'eslint-plugin-import'
|
|
8
|
+
import prettierConfig from 'eslint-config-prettier'
|
|
9
|
+
import globals from 'globals'
|
|
10
|
+
|
|
11
|
+
export default [
|
|
12
|
+
// Ignore test-cases directory (these files intentionally have errors for testing)
|
|
13
|
+
// Ignore dist directory (generated TypeScript output)
|
|
14
|
+
{
|
|
15
|
+
ignores: ['dist/**', 'test-cases/**'],
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
// Base recommended configs (only jsx-a11y and prettier, not eslint:recommended to match original behavior)
|
|
19
|
+
jsxA11yPlugin.flatConfigs.recommended,
|
|
20
|
+
prettierConfig,
|
|
21
|
+
|
|
22
|
+
// JavaScript/JSX configuration
|
|
23
|
+
{
|
|
24
|
+
files: ['**/*.{js,mjs,cjs,jsx}'],
|
|
25
|
+
|
|
26
|
+
plugins: {
|
|
27
|
+
'react': reactPlugin,
|
|
28
|
+
'react-hooks': reactHooksPlugin,
|
|
29
|
+
'jest': jestPlugin,
|
|
30
|
+
'import': importPlugin,
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
languageOptions: {
|
|
34
|
+
ecmaVersion: 'latest',
|
|
35
|
+
sourceType: 'module',
|
|
36
|
+
|
|
37
|
+
parserOptions: {
|
|
38
|
+
ecmaFeatures: {
|
|
39
|
+
jsx: true,
|
|
40
|
+
generators: true,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
globals: {
|
|
45
|
+
...globals.browser,
|
|
46
|
+
...globals.node,
|
|
47
|
+
...globals.commonjs,
|
|
48
|
+
...globals.es2021,
|
|
49
|
+
...globals.jest,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
settings: {
|
|
54
|
+
react: {
|
|
55
|
+
version: 'detect',
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
rules: {
|
|
60
|
+
'no-var': 'warn',
|
|
61
|
+
'curly': 'warn',
|
|
62
|
+
'prefer-destructuring': 'warn',
|
|
63
|
+
'import/order': [
|
|
64
|
+
'warn',
|
|
65
|
+
{
|
|
66
|
+
'newlines-between': 'always',
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
'import/export': 'warn',
|
|
70
|
+
'jest/no-focused-tests': 'error',
|
|
71
|
+
'no-console': 'warn',
|
|
72
|
+
'no-debugger': 'error',
|
|
73
|
+
'prefer-template': 'warn',
|
|
74
|
+
'react/prop-types': 'error',
|
|
75
|
+
'react-hooks/exhaustive-deps': 'error',
|
|
76
|
+
'react/jsx-key': ['warn', { checkFragmentShorthand: true }],
|
|
77
|
+
'no-restricted-imports': [
|
|
78
|
+
'warn',
|
|
79
|
+
{
|
|
80
|
+
patterns: [
|
|
81
|
+
{
|
|
82
|
+
group: ['@typeform/kitt/lib/*'],
|
|
83
|
+
message:
|
|
84
|
+
"🙈 The lib notation is deprecated. Refer to the Kitt's doc, and ping the FEAR team if you have a doubt",
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
// TypeScript configuration
|
|
93
|
+
{
|
|
94
|
+
files: ['**/*.{ts,tsx}'],
|
|
95
|
+
|
|
96
|
+
plugins: {
|
|
97
|
+
'@typescript-eslint': tseslint.plugin,
|
|
98
|
+
'react': reactPlugin,
|
|
99
|
+
'react-hooks': reactHooksPlugin,
|
|
100
|
+
'jest': jestPlugin,
|
|
101
|
+
'import': importPlugin,
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
languageOptions: {
|
|
105
|
+
ecmaVersion: 'latest',
|
|
106
|
+
sourceType: 'module',
|
|
107
|
+
parser: tseslint.parser,
|
|
108
|
+
|
|
109
|
+
parserOptions: {
|
|
110
|
+
ecmaFeatures: {
|
|
111
|
+
jsx: true,
|
|
112
|
+
generators: true,
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
|
|
116
|
+
globals: {
|
|
117
|
+
...globals.browser,
|
|
118
|
+
...globals.node,
|
|
119
|
+
...globals.commonjs,
|
|
120
|
+
...globals.es2021,
|
|
121
|
+
...globals.jest,
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
settings: {
|
|
126
|
+
react: {
|
|
127
|
+
version: 'detect',
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
|
|
131
|
+
rules: {
|
|
132
|
+
'no-var': 'warn',
|
|
133
|
+
'curly': 'warn',
|
|
134
|
+
'prefer-destructuring': 'warn',
|
|
135
|
+
'@typescript-eslint/no-extra-semi': 'off',
|
|
136
|
+
'import/order': [
|
|
137
|
+
'warn',
|
|
138
|
+
{
|
|
139
|
+
'newlines-between': 'always',
|
|
140
|
+
},
|
|
141
|
+
],
|
|
142
|
+
'import/export': 'warn',
|
|
143
|
+
'jest/no-focused-tests': 'error',
|
|
144
|
+
'no-console': 'warn',
|
|
145
|
+
'no-debugger': 'error',
|
|
146
|
+
'prefer-template': 'warn',
|
|
147
|
+
'react/prop-types': 'error',
|
|
148
|
+
'react-hooks/exhaustive-deps': 'error',
|
|
149
|
+
'react/jsx-key': ['warn', { checkFragmentShorthand: true }],
|
|
150
|
+
'@typescript-eslint/no-explicit-any': 'warn',
|
|
151
|
+
'@typescript-eslint/consistent-type-imports': [
|
|
152
|
+
'warn',
|
|
153
|
+
{
|
|
154
|
+
prefer: 'type-imports',
|
|
155
|
+
fixStyle: 'inline-type-imports',
|
|
156
|
+
},
|
|
157
|
+
],
|
|
158
|
+
'no-restricted-imports': [
|
|
159
|
+
'warn',
|
|
160
|
+
{
|
|
161
|
+
patterns: [
|
|
162
|
+
{
|
|
163
|
+
group: ['@typeform/kitt/lib/*'],
|
|
164
|
+
message:
|
|
165
|
+
"🙈 The lib notation is deprecated. Refer to the Kitt's doc, and ping the FEAR team if you have a doubt",
|
|
166
|
+
},
|
|
167
|
+
],
|
|
168
|
+
},
|
|
169
|
+
],
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
]
|
package/jest.config.js
CHANGED
package/package.json
CHANGED
|
@@ -1,66 +1,67 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typeform/eslint-config",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.2.0-beta.1",
|
|
4
4
|
"description": "ESLint configuration for Typeform front-end projects",
|
|
5
|
-
"
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
6
14
|
"repository": "git@github.com:Typeform/eslint-config-typeform.git",
|
|
7
15
|
"license": "LGPL-3.0-only",
|
|
8
16
|
"private": false,
|
|
9
17
|
"engines": {
|
|
10
|
-
"node": ">=
|
|
18
|
+
"node": ">=20"
|
|
11
19
|
},
|
|
12
20
|
"scripts": {
|
|
13
|
-
"
|
|
21
|
+
"build": "tsc",
|
|
22
|
+
"prepare": "husky && yarn build",
|
|
23
|
+
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
|
|
14
24
|
"eslint": "eslint",
|
|
15
25
|
"lint": "yarn run eslint .",
|
|
16
|
-
"publish:npm": "npm config set @typeform:registry https://registry.npmjs.org/ && npm config set '//registry.npmjs.org/:_authToken' $NPM_TOKEN && npm publish"
|
|
17
|
-
},
|
|
18
|
-
"husky": {
|
|
19
|
-
"hooks": {
|
|
20
|
-
"pre-commit": "lint-staged"
|
|
21
|
-
}
|
|
26
|
+
"publish:npm": "yarn build && npm config set @typeform:registry https://registry.npmjs.org/ && npm config set '//registry.npmjs.org/:_authToken' $NPM_TOKEN && npm publish"
|
|
22
27
|
},
|
|
23
28
|
"lint-staged": {
|
|
24
|
-
"*.js": "yarn run eslint --fix",
|
|
25
|
-
"*.{js,css,md}": "prettier --write"
|
|
29
|
+
"*.{js,ts}": "yarn run eslint --fix",
|
|
30
|
+
"*.{js,ts,css,md}": "prettier --write"
|
|
26
31
|
},
|
|
27
32
|
"publishConfig": {
|
|
28
33
|
"access": "public"
|
|
29
34
|
},
|
|
30
|
-
"prettier": "./prettier",
|
|
35
|
+
"prettier": "./prettier/index.cjs",
|
|
31
36
|
"dependencies": {
|
|
32
|
-
"@
|
|
33
|
-
"@typescript-eslint/
|
|
34
|
-
"
|
|
35
|
-
"eslint-config-prettier": "^
|
|
36
|
-
"eslint-
|
|
37
|
-
"eslint-
|
|
38
|
-
"eslint-
|
|
39
|
-
"eslint-plugin-
|
|
40
|
-
"eslint-plugin-
|
|
41
|
-
"eslint-plugin-
|
|
42
|
-
"eslint-plugin-
|
|
43
|
-
"
|
|
44
|
-
"eslint
|
|
45
|
-
"
|
|
46
|
-
"eslint-plugin-react": "^7.31.11",
|
|
47
|
-
"eslint-plugin-react-hooks": "^4.6.0"
|
|
37
|
+
"@eslint/js": "^9.16.0",
|
|
38
|
+
"@typescript-eslint/eslint-plugin": "^8.18.1",
|
|
39
|
+
"@typescript-eslint/parser": "^8.18.1",
|
|
40
|
+
"eslint-config-prettier": "^9.1.0",
|
|
41
|
+
"eslint-plugin-import": "^2.31.0",
|
|
42
|
+
"eslint-plugin-jest": "^28.9.0",
|
|
43
|
+
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
44
|
+
"eslint-plugin-n": "^17.14.0",
|
|
45
|
+
"eslint-plugin-promise": "^7.2.1",
|
|
46
|
+
"eslint-plugin-react": "^7.37.2",
|
|
47
|
+
"eslint-plugin-react-hooks": "^5.1.0",
|
|
48
|
+
"globals": "^15.13.0",
|
|
49
|
+
"typescript-eslint": "^8.18.1",
|
|
50
|
+
"yarn": "^1.22.22"
|
|
48
51
|
},
|
|
49
52
|
"peerDependencies": {
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"typescript": ">=4"
|
|
53
|
+
"eslint": ">=9.0.0",
|
|
54
|
+
"typescript": ">=5"
|
|
53
55
|
},
|
|
54
56
|
"devDependencies": {
|
|
55
|
-
"@babel/core": "^7.12.9",
|
|
56
57
|
"@semantic-release/exec": "^6.0.3",
|
|
57
|
-
"eslint": "^
|
|
58
|
-
"husky": "^
|
|
59
|
-
"jest": "^29.
|
|
60
|
-
"lint-staged": "^
|
|
61
|
-
"prettier": "^
|
|
62
|
-
"semantic-release": "^
|
|
63
|
-
"typescript": "^
|
|
58
|
+
"eslint": "^9.16.0",
|
|
59
|
+
"husky": "^9.1.7",
|
|
60
|
+
"jest": "^29.7.0",
|
|
61
|
+
"lint-staged": "^15.2.11",
|
|
62
|
+
"prettier": "^3.4.2",
|
|
63
|
+
"semantic-release": "^24.2.0",
|
|
64
|
+
"typescript": "^5.7.2"
|
|
64
65
|
},
|
|
65
66
|
"release": {
|
|
66
67
|
"branches": [
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ES2022",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"declaration": true,
|
|
7
|
+
"declarationMap": true,
|
|
8
|
+
"outDir": "./dist",
|
|
9
|
+
"rootDir": "./",
|
|
10
|
+
"strict": true,
|
|
11
|
+
"esModuleInterop": true,
|
|
12
|
+
"skipLibCheck": true,
|
|
13
|
+
"forceConsistentCasingInFileNames": true,
|
|
14
|
+
"resolveJsonModule": true,
|
|
15
|
+
"allowSyntheticDefaultImports": true,
|
|
16
|
+
"allowUnreachableCode": false
|
|
17
|
+
},
|
|
18
|
+
"include": [
|
|
19
|
+
"index.ts",
|
|
20
|
+
"prettier/index.js",
|
|
21
|
+
"types.d.ts"
|
|
22
|
+
],
|
|
23
|
+
"exclude": [
|
|
24
|
+
"node_modules",
|
|
25
|
+
"dist",
|
|
26
|
+
"test-cases",
|
|
27
|
+
"**/*.test.js"
|
|
28
|
+
]
|
|
29
|
+
}
|
package/types.d.ts
ADDED
package/.eslintignore
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/test-cases/**
|
package/.eslintrc
DELETED
package/index.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
extends: ['react-app', 'plugin:jsx-a11y/recommended', 'prettier'],
|
|
3
|
-
plugins: ['jest'],
|
|
4
|
-
env: {
|
|
5
|
-
'browser': true,
|
|
6
|
-
'commonjs': true,
|
|
7
|
-
'es6': true,
|
|
8
|
-
'jest': true,
|
|
9
|
-
'node': true,
|
|
10
|
-
'jest/globals': true,
|
|
11
|
-
},
|
|
12
|
-
parserOptions: {
|
|
13
|
-
ecmaFeatures: {
|
|
14
|
-
generators: true,
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
rules: {
|
|
18
|
-
'no-var': 'warn',
|
|
19
|
-
'curly': 'warn',
|
|
20
|
-
'prefer-destructuring': 'warn',
|
|
21
|
-
'@typescript-eslint/no-extra-semi': 'off',
|
|
22
|
-
'import/order': [
|
|
23
|
-
'warn',
|
|
24
|
-
{
|
|
25
|
-
'newlines-between': 'always',
|
|
26
|
-
},
|
|
27
|
-
],
|
|
28
|
-
'import/export': 'warn',
|
|
29
|
-
'jest/no-focused-tests': 'error',
|
|
30
|
-
'no-console': 'warn',
|
|
31
|
-
'no-debugger': 'error',
|
|
32
|
-
'prefer-template': 'warn',
|
|
33
|
-
'react/prop-types': 'error',
|
|
34
|
-
'react-hooks/exhaustive-deps': 'error',
|
|
35
|
-
'react/jsx-key': ['warn', { checkFragmentShorthand: true }],
|
|
36
|
-
'@typescript-eslint/no-explicit-any': 'warn',
|
|
37
|
-
'@typescript-eslint/consistent-type-imports': [
|
|
38
|
-
'warn',
|
|
39
|
-
{
|
|
40
|
-
prefer: 'type-imports',
|
|
41
|
-
fixStyle: 'inline-type-imports',
|
|
42
|
-
},
|
|
43
|
-
],
|
|
44
|
-
'no-restricted-imports': [
|
|
45
|
-
'warn',
|
|
46
|
-
{
|
|
47
|
-
patterns: [
|
|
48
|
-
{
|
|
49
|
-
group: ['@typeform/kitt/lib/*'],
|
|
50
|
-
message:
|
|
51
|
-
"🙈 The lib notation is deprecated. Refer to the Kitt's doc, and ping the FEAR team if you have a doubt",
|
|
52
|
-
},
|
|
53
|
-
],
|
|
54
|
-
},
|
|
55
|
-
],
|
|
56
|
-
},
|
|
57
|
-
settings: {
|
|
58
|
-
react: {
|
|
59
|
-
version: 'detect',
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
}
|
|
File without changes
|