Skip to content

Commit

Permalink
Upgrade JS, pnpm, and ESLint
Browse files Browse the repository at this point in the history
  • Loading branch information
bmuller committed Apr 22, 2024
1 parent 45a5533 commit efcbfd0
Show file tree
Hide file tree
Showing 14 changed files with 7,306 additions and 4,971 deletions.
47 changes: 0 additions & 47 deletions .eslintrc.js

This file was deleted.

7 changes: 4 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ name: ci
on: push

env:
NODE_VERSION: 20.9.0
NODE_VERSION: 20.12.2
PNPM_VERSION: 9

jobs:
test:
Expand All @@ -11,11 +12,11 @@ jobs:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
with:
version: 8
version: ${{ env.PNPM_VERSION }}
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "pnpm"
cache: pnpm
- run: pnpm install --no-optional
- run: pnpm lint
- run: pnpm test
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nodejs 20.9.0
nodejs 20.12.2
67 changes: 67 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import js from '@eslint/js'
import globals from 'globals'
import { FlatCompat } from '@eslint/eslintrc'
import tsParser from '@typescript-eslint/parser'
import tseslint from 'typescript-eslint'
import react from 'eslint-plugin-react'

const OFF = 0,
WARN = 1,
ERROR = 2

const compat = new FlatCompat()

export default tseslint.config(
js.configs.recommended,
...tseslint.configs.recommended,
...compat.extends('prettier', 'plugin:react-hooks/recommended'),
{
plugins: {
react
},
languageOptions: {
parser: tsParser,
ecmaVersion: 12,
sourceType: 'module',
globals: {
...globals.browser,
...globals.node,
...globals.jest,
},
parserOptions: {
project: ['./tsconfig.json'],
ecmaFeatures: {
jsx: true,
},
},
},
rules: {
'react-hooks/exhaustive-deps': OFF,
'react/prop-types': OFF,
'node/no-callback-literal': OFF,
'n/no-callback-literal': OFF,
camelcase: OFF,
'sort-imports': ['error', { ignoreDeclarationSort: true }],
'sort-vars': ERROR,
'no-debugger': process.env.NODE_ENV === 'development' ? OFF : ERROR,
'no-unused-vars': [
'error',
{
caughtErrors: 'none',
// ignore vars that start with underscore, like _result
argsIgnorePattern: '^_',
varsIgnorePattern: '^_|React',
},
],
'@typescript-eslint/no-unused-vars': [
'error',
{
caughtErrors: 'none',
// ignore vars that start with underscore, like _result
argsIgnorePattern: '^_',
varsIgnorePattern: '^_|React',
},
],
},
}
)
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"license": "MIT",
"homepage": "https://developer.parallelmarkets.com/docs/javascript",
"devDependencies": {
"globals": "^15.0.0",
"jest": "^29.7.0",
"rollup": "^4.12.1"
"rollup": "^4.16.2"
}
}
7 changes: 0 additions & 7 deletions packages/react/.eslintrc.js

This file was deleted.

67 changes: 67 additions & 0 deletions packages/react/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import js from '@eslint/js'
import globals from 'globals'
import { FlatCompat } from '@eslint/eslintrc'
import tsParser from '@typescript-eslint/parser'
import tseslint from 'typescript-eslint'
import react from 'eslint-plugin-react'

const OFF = 0,
WARN = 1,
ERROR = 2

const compat = new FlatCompat()

export default tseslint.config(
js.configs.recommended,
...tseslint.configs.recommended,
...compat.extends('prettier', 'plugin:react-hooks/recommended'),
{
plugins: {
react,
},
languageOptions: {
parser: tsParser,
ecmaVersion: 12,
sourceType: 'module',
globals: {
...globals.browser,
...globals.node,
...globals.jest,
},
parserOptions: {
project: ['../../tsconfig.json'],
ecmaFeatures: {
jsx: true,
},
},
},
rules: {
'react-hooks/exhaustive-deps': OFF,
'react/prop-types': OFF,
'node/no-callback-literal': OFF,
'n/no-callback-literal': OFF,
camelcase: OFF,
'sort-imports': ['error', { ignoreDeclarationSort: true }],
'sort-vars': ERROR,
'no-debugger': process.env.NODE_ENV === 'development' ? OFF : ERROR,
'no-unused-vars': [
'error',
{
caughtErrors: 'none',
// ignore vars that start with underscore, like _result
argsIgnorePattern: '^_',
varsIgnorePattern: '^_|React',
},
],
'@typescript-eslint/no-unused-vars': [
'error',
{
caughtErrors: 'none',
// ignore vars that start with underscore, like _result
argsIgnorePattern: '^_',
varsIgnorePattern: '^_|React',
},
],
},
},
)
22 changes: 12 additions & 10 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,32 +42,34 @@
"watch": "pnpm typecheck --watch --noEmit"
},
"devDependencies": {
"@babel/core": "^7.24.0",
"@babel/eslint-parser": "^7.23.10",
"@babel/plugin-syntax-jsx": "^7.23.3",
"@babel/preset-env": "^7.24.0",
"@babel/core": "^7.24.4",
"@babel/eslint-parser": "^7.24.1",
"@babel/plugin-syntax-jsx": "^7.24.1",
"@babel/preset-env": "^7.24.4",
"@parallelmarkets/vanilla": "workspace:*",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-image": "^3.0.3",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-replace": "^5.0.5",
"@rollup/plugin-typescript": "^11.1.6",
"@testing-library/react": "^14.2.1",
"@types/node": "^20.11.25",
"@types/react": "^18.2.64",
"@testing-library/react": "^15.0.2",
"@types/node": "^20.12.7",
"@types/react": "^18.2.79",
"babel-jest": "^29.7.0",
"babel-preset-react-app": "^10.0.1",
"eslint": "^8.57.0",
"eslint": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-n": "^16.6.2",
"eslint-plugin-n": "^17.2.1",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-react": "^7.34.0",
"eslint-plugin-react-hooks": "^4.6.0",
"globals": "^15.0.0",
"jest": "^29.7.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"tslib": "^2.6.2",
"typescript": "^5.4.2"
"typescript": "^5.4.5"
},
"peerDependencies": {
"@parallelmarkets/vanilla": "workspace:*",
Expand Down
1 change: 0 additions & 1 deletion packages/react/src/@types/assets/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
declare module '*.svg' {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import React = require('react')
const src: string
export default src
Expand Down
27 changes: 0 additions & 27 deletions packages/vanilla/.eslintrc.js

This file was deleted.

41 changes: 41 additions & 0 deletions packages/vanilla/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import js from '@eslint/js'
import globals from 'globals'
import { FlatCompat } from '@eslint/eslintrc'
import tsParser from '@typescript-eslint/parser'
import tseslint from 'typescript-eslint'

const OFF = 0,
WARN = 1,
ERROR = 2

const compat = new FlatCompat()

export default tseslint.config(js.configs.recommended, ...tseslint.configs.recommended, ...compat.extends('prettier'), {
languageOptions: {
parser: tsParser,
ecmaVersion: 12,
sourceType: 'module',
globals: {
...globals.browser,
...globals.node,
...globals.jest,
},
},
rules: {
'node/no-callback-literal': OFF,
'n/no-callback-literal': OFF,
camelcase: OFF,
'sort-imports': ['error', { ignoreDeclarationSort: true }],
'sort-vars': ERROR,
'no-debugger': process.env.NODE_ENV === 'development' ? OFF : ERROR,
'no-unused-vars': [
'error',
{
caughtErrors: 'none',
// ignore vars that start with underscore, like _result
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
},
],
},
})
23 changes: 11 additions & 12 deletions packages/vanilla/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,30 +42,29 @@
"watch": "pnpm typecheck --watch --noEmit"
},
"devDependencies": {
"@babel/core": "^7.24.0",
"@babel/eslint-parser": "^7.23.10",
"@babel/preset-env": "^7.24.0",
"@babel/preset-typescript": "^7.23.3",
"@babel/core": "^7.24.4",
"@babel/eslint-parser": "^7.24.1",
"@babel/preset-env": "^7.24.4",
"@babel/preset-typescript": "^7.24.1",
"@jest/globals": "^29.7.0",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-replace": "^5.0.5",
"@rollup/plugin-typescript": "^11.1.6",
"@types/jest": "^29.5.12",
"@types/node": "^20.11.25",
"@typescript-eslint/eslint-plugin": "^7.1.1",
"@typescript-eslint/parser": "^7.1.1",
"eslint": "^8.57.0",
"@types/node": "^20.12.7",
"eslint": "^9.1.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-n": "^16.6.2",
"eslint-plugin-n": "^17.2.1",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-promise": "^6.1.1",
"globals": "^15.0.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"prettier": "^3.2.5",
"rollup": "^4.12.1",
"rollup": "^4.16.2",
"tslib": "^2.6.2",
"typescript": "^5.4.2",
"typescript-eslint": "7.1.1"
"typescript": "^5.4.5",
"typescript-eslint": "7.7.1"
}
}
Loading

0 comments on commit efcbfd0

Please sign in to comment.