Skip to content

Commit 36ba75f

Browse files
authored
Merge pull request #59 from tkrotoff/react18
Use React 18 in examples + update most npm packages when possible
2 parents e723888 + 5b9692c commit 36ba75f

File tree

187 files changed

+45989
-18031
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

187 files changed

+45989
-18031
lines changed

.eslintignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
node_modules/
22
build/
33
dist/
4-
lib/
5-
lib-es5/
64
coverage/

.eslintrc.js

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,22 @@ const config = {
66
parserOptions: {},
77
extends: [
88
// /!\ Order matters: the next one overrides rules from the previous one
9-
'plugin:unicorn/recommended',
109
'plugin:jest/recommended',
10+
'plugin:unicorn/recommended',
1111
'airbnb',
1212
// Already done by Airbnb
1313
//'plugin:react/recommended'
1414
'plugin:@typescript-eslint/recommended',
15-
'plugin:prettier/recommended',
16-
'prettier/@typescript-eslint',
17-
'prettier/react'
15+
'plugin:prettier/recommended'
1816
],
1917
plugins: ['simple-import-sort', 'react-hooks'],
2018
env: {
2119
browser: true
2220
},
23-
globals: {
24-
// Jest Puppeteer, see https://github.com/smooth-code/jest-puppeteer/blob/v4.0.0/README.md#configure-eslint
25-
page: true
26-
},
21+
globals: {},
2722

2823
rules: {
29-
'no-console': 'off',
24+
'no-console': ['error', { allow: ['error', 'info'] }],
3025
'no-alert': 'off',
3126
'no-underscore-dangle': 'off',
3227
'no-plusplus': 'off',
@@ -46,10 +41,10 @@ const config = {
4641
'import/prefer-default-export': 'off',
4742
'import/extensions': 'off',
4843

49-
'simple-import-sort/sort': [
44+
'simple-import-sort/imports': [
5045
'error',
5146
{
52-
// https://github.com/lydell/eslint-plugin-simple-import-sort/blob/v5.0.2/src/sort.js#L3-L15
47+
// https://github.com/lydell/eslint-plugin-simple-import-sort/blob/v7.0.0/src/imports.js#L5
5348
groups: [
5449
// Side effect imports
5550
['^\\u0000'],
@@ -63,8 +58,8 @@ const config = {
6358
],
6459

6560
// Absolute imports and other imports such as Vue-style `@/foo`
66-
// Anything that does not start with a dot
67-
['^[^.]'],
61+
// Anything not matched in another group
62+
['^'],
6863

6964
// Relative imports
7065
[
@@ -86,6 +81,7 @@ const config = {
8681
]
8782
}
8883
],
84+
'simple-import-sort/exports': 'error',
8985

9086
// https://github.com/typescript-eslint/typescript-eslint/blob/v4.1.0/packages/eslint-plugin/docs/rules/no-use-before-define.md
9187
'no-use-before-define': 'off',
@@ -119,21 +115,38 @@ const config = {
119115
// [IE does not support for...of](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of#Browser_compatibility)
120116
'unicorn/no-for-loop': 'off',
121117
'unicorn/no-null': 'off',
118+
// https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v27.0.0/docs/rules/no-array-for-each.md
119+
// https://github.com/github/eslint-plugin-github/blob/v4.1.1/docs/rules/array-foreach.md
120+
// conflicts with
121+
// https://github.com/airbnb/javascript/issues/1271
122+
'unicorn/no-array-for-each': 'off',
123+
// FIXME Activate when ES modules are well supported
124+
'unicorn/prefer-module': 'off',
122125
'unicorn/prefer-query-selector': 'off',
126+
'unicorn/numeric-separators-style': 'off',
127+
'unicorn/no-await-expression-member': 'off',
123128

124129
'jsx-a11y/label-has-associated-control': 'off',
125130

126131
'react/no-unescaped-entities': 'off',
127132
'react/jsx-filename-extension': ['error', { extensions: ['.tsx', '.jsx'] }],
133+
'react/jsx-uses-react': 'off',
134+
'react/react-in-jsx-scope': 'off',
135+
// FIXME https://github.com/yannickcr/eslint-plugin-react/issues/3114#issuecomment-951725512
136+
'react/jsx-no-bind': 'off',
128137
'react/jsx-pascal-case': 'off',
129138
'react/jsx-props-no-spreading': 'off',
130139
'react/static-property-placement': 'off',
131140
'react/state-in-constructor': 'off',
141+
'react/no-unused-class-component-methods': 'off',
142+
'react/no-unstable-nested-components': 'off',
143+
'react/require-default-props': 'off',
144+
'react/default-props-match-prop-types': 'off',
145+
'react/no-unused-prop-types': 'off',
132146

133147
'react-hooks/rules-of-hooks': 'error',
134148
'react-hooks/exhaustive-deps': 'error',
135149

136-
'jest/no-expect-resolves': 'error',
137150
'jest/expect-expect': 'off'
138151
},
139152

@@ -154,8 +167,10 @@ const config = {
154167
}
155168
},
156169
{
157-
files: ['*.test.tsx'],
170+
files: ['*.test.ts', '*.test.tsx'],
158171
rules: {
172+
'unicorn/consistent-function-scoping': 'off',
173+
159174
'jsx-a11y/iframe-has-title': 'off'
160175
}
161176
}

.github/workflows/node.js.yml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# https://github.com/actions/starter-workflows/blob/c934669ce246e6d64e54006b714b04199cbe445b/ci/node.js.yml
1+
# https://github.com/actions/starter-workflows/blob/692c4c52607f67dd3ee34ad0b7c26066ae85bbae/ci/node.js.yml
22

33
name: Node.js CI
44

@@ -11,19 +11,18 @@ jobs:
1111

1212
strategy:
1313
matrix:
14-
node-version: [12.x, 14.x]
14+
node-version: [16.x, 18.x]
1515

1616
steps:
17-
- uses: actions/checkout@v2
17+
- uses: actions/checkout@v3
1818
- name: Use Node.js ${{matrix.node-version}}
19-
uses: actions/setup-node@v1
19+
uses: actions/setup-node@v3
2020
with:
2121
node-version: ${{matrix.node-version}}
22-
- run: yarn install
23-
- run: yarn prepublishOnly
24-
- run: yarn build
25-
- run: yarn lint
26-
- run: yarn test:coverage
27-
- run: yarn test:e2e
28-
env:
29-
CI: true
22+
cache: 'npm'
23+
- run: npm install
24+
- run: npx playwright install --with-deps
25+
- run: npm run build
26+
- run: npm run lint
27+
- run: npm run test:coverage
28+
- run: npm run test:e2e

.github/workflows/npm-publish.yml

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# https://github.com/actions/starter-workflows/blob/c934669ce246e6d64e54006b714b04199cbe445b/ci/npm-publish.yml
1+
# https://github.com/actions/starter-workflows/blob/692c4c52607f67dd3ee34ad0b7c26066ae85bbae/ci/npm-publish.yml
22

33
name: Node.js Package
44

@@ -10,28 +10,27 @@ jobs:
1010
build:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v2
14-
- uses: actions/setup-node@v1
13+
- uses: actions/checkout@v3
14+
- uses: actions/setup-node@v3
1515
with:
16-
node-version: 12
17-
- run: yarn install
18-
- run: yarn prepublishOnly
19-
- run: yarn build
20-
- run: yarn lint
21-
- run: yarn test:coverage
22-
- run: yarn test:e2e
16+
node-version: 16
17+
- run: npm install
18+
- run: npm run prepublishOnly
19+
- run: npm run build
20+
- run: npm run lint
21+
- run: npm run test:coverage
22+
- run: npm run test:e2e
2323

2424
publish-npm:
2525
needs: build
2626
runs-on: ubuntu-latest
2727
steps:
28-
- uses: actions/checkout@v2
29-
- uses: actions/setup-node@v1
28+
- uses: actions/checkout@v3
29+
- uses: actions/setup-node@v3
3030
with:
31-
node-version: 12
31+
node-version: 16
3232
registry-url: https://registry.npmjs.org/
33-
- run: yarn install
34-
- run: yarn prepublishOnly
35-
- run: yarn lerna publish from-git --yes
33+
- run: npm install
34+
- run: npm run publish
3635
env:
3736
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

.gitignore

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ node_modules/
44
# Generated files
55
build/
66
dist/
7-
lib/
8-
lib-es5/
97
coverage/
108

11-
# rollup-plugin-typescript2
12-
# [.rpt2_cache should be in /tmp](https://github.com/ezolenko/rollup-plugin-typescript2/issues/34)
13-
.rpt2_cache/
9+
# React Native example
10+
examples/ReactNative/package-lock.json
11+
examples/ReactNative/.expo/
12+
examples/ReactNative/ios/
13+
examples/ReactNative/android/

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npm run precommit

.husky/pre-push

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npm run prepush

.huskyrc.js

Lines changed: 0 additions & 8 deletions
This file was deleted.

.prettierignore

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
.git/
2+
.husky/
23
node_modules/
34
build/
45
dist/
5-
lib/
6-
lib-es5/
76
coverage/
87
.gitignore
98
.prettierignore
109
.eslintignore
1110
.editorconfig
1211
.browserslistrc
1312
*.png
14-
yarn.lock
15-
yarn-error.log
13+
package-lock.json
1614
LICENSE
15+
16+
# React Native example
17+
examples/ReactNative/.expo/
18+
examples/ReactNative/ios/
19+
examples/ReactNative/android/

.stylelintrc.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
// @ts-check
22

3-
/** @type {Partial<import('stylelint').Configuration>} */
3+
/** @type {Partial<import('stylelint').Config>} */
44
const config = {
55
extends: [
66
// /!\ Order matters: the next one overrides rules from the previous one
77

8-
// Includes stylelint-config-recommended-scss and stylelint-config-standard
9-
'stylelint-config-twbs-bootstrap/scss',
8+
// Extends stylelint-config-standard-scss which extends stylelint-config-recommended-scss
9+
'stylelint-config-twbs-bootstrap',
1010

1111
'stylelint-prettier/recommended'
1212
],

0 commit comments

Comments
 (0)