Skip to content

Commit 26b06e8

Browse files
authored
feat!: move to ESM and eslint v9 (#641)
* feat: upgrade to eslint v9 and fix breaking changes * chore: remove testing file * feat!: move to ESM * test: remove unused import and update gitignore * test: update pattern for finding test files * chore: sync changes from other packages * chore: update dependencies and run deduplicate * fix!: use ESM tsconfig * fix: update order of rules and remove react-native specific settings
1 parent adbb402 commit 26b06e8

25 files changed

+2130
-2104
lines changed

.github/workflows/resolve-yarn-lock.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66

77
jobs:
88
resolve-yarn-lock-on-comment:
9-
name: '/'
9+
name: 'Resolve yarn.lock'
1010
if: contains(github.event.comment.body, '/resolve yarn.lock')
1111
uses: technology-studio/github-workflows/.github/workflows/_resolve-yarn-lock.yml@main
1212
secrets: inherit

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ npm-debug.log
1111
yarn-error.log
1212
lib
1313
coverage
14+
*.tgz

.husky/pre-commit

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
yarn git-hook
2-
1+
yarn -s lint-staged

.husky/prepare-commit-msg

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
yarn commitlint --edit || exec < /dev/tty && yarn txo-cz --hook > /dev/null 2>&1 || true
2-

.lintstagedrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"*.{js,jsx,ts,tsx}": "eslint --cache --ext .ts,.tsx"
2+
"*.{js,jsx,ts,tsx}": "eslint --cache --max-warnings 0 --no-warn-ignored"
33
}

.releaserc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* @Copyright: Technology Studio
55
**/
66

7-
module.exports = {
7+
export default {
88
extends: [
99
'@txo/semantic-release',
1010
],

.vscode/launch.json

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,22 @@
55
"version": "0.2.0",
66
"configurations": [
77
{
8-
"name": "Debug Jest Tests with yarn",
8+
"name": "Debug Jest Tests",
99
"type": "node",
1010
"request": "launch",
11-
"runtimeExecutable": "yarn",
12-
"args": [
13-
"test",
14-
"--",
15-
"--runInBand",
16-
"--coverage=false"
17-
],
18-
"runtimeArgs": [
19-
"--inspect-brk"
20-
],
11+
"runtimeArgs": [ "--inspect-brk", "${workspaceRoot}/node_modules/.bin/jest", "--runInBand", "--coverage", "false", "${file}" ],
2112
"console": "integratedTerminal",
2213
"internalConsoleOptions": "neverOpen"
2314
},
2415
{
25-
"name": "eslint",
16+
"name": "Debug Jest Tests with yarn",
2617
"type": "node",
2718
"request": "launch",
2819
"runtimeExecutable": "yarn",
29-
"cwd": "${workspaceFolder}",
30-
"runtimeArgs": [
31-
"eslint",
32-
"${relativeFile}"
33-
],
34-
"sourceMaps": true,
35-
}
20+
"args": [ "test", "--runInBand", "--coverage=false", "${file}" ],
21+
"runtimeArgs": [ "--inspect-brk" ],
22+
"console": "integratedTerminal",
23+
"internalConsoleOptions": "neverOpen"
24+
},
3625
]
3726
}

__tests__/Tests/Lint.test.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
1-
/* eslint-disable @typescript-eslint/no-var-requires */
2-
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
3-
/* eslint-disable @typescript-eslint/no-unsafe-call */
4-
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
51
/**
62
* @Author: Rostislav Simonik <rostislav.simonik@technologystudio.sk>
73
* @Date: 2018-01-09T00:56:40+01:00
84
* @Copyright: Technology Studio
95
**/
106

11-
const { FlatESLint } = require('eslint/use-at-your-own-risk')
7+
import { ESLint } from 'eslint'
128

139
test('shoud not have lint issues', async () => {
14-
const eslint = new FlatESLint()
15-
const results = await eslint.lintFiles(['test/**/*.ts'])
10+
const eslint = new ESLint()
11+
const results = await eslint.lintFiles(['test/**/*.tsx'])
12+
// eslint-disable-next-line @typescript-eslint/no-magic-numbers -- result should have no errors
1613
const isWithoutError = results.every((result: { errorCount: number }) => result.errorCount === 0)
1714
expect(isWithoutError).toBe(true)
15+
// eslint-disable-next-line @typescript-eslint/no-magic-numbers -- we want to make the timeout longer
1816
}, 20000)

commitlint.config.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@
44
* @Copyright: Technology Studio
55
**/
66

7-
const commitlintConfig = {
7+
export default {
88
extends: [
99
'@txo/commitlint',
1010
],
1111
}
12-
13-
module.exports = commitlintConfig
-15.2 KB
Binary file not shown.

0 commit comments

Comments
 (0)