Skip to content

Commit f916378

Browse files
authored
chore: updated (dev)dependencies, incl. [email protected] (#62)
1 parent 12163c5 commit f916378

File tree

13 files changed

+2579
-2111
lines changed

13 files changed

+2579
-2111
lines changed

.eslintrc.js

+16-37
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,34 @@
1-
const path = require('path')
2-
31
module.exports = {
4-
extends: [
5-
'eslint-config-ns',
6-
'plugin:@typescript-eslint/recommended',
7-
'prettier/@typescript-eslint',
8-
],
9-
parser: '@typescript-eslint/parser',
10-
plugins: ['react-hooks'],
2+
extends: ['eslint-config-ns-ts'],
113
globals: {
124
__DEV__: true,
135
},
146
rules: {
15-
// universal rules
16-
'import/extensions': 0,
7+
// general ESLint rules
178
'no-underscore-dangle': 0,
18-
'sort-keys': 0,
19-
20-
// jest settings
21-
'jest/prefer-strict-equal': 'error',
229

2310
// react settings
2411
'react/jsx-props-no-spreading': 0,
25-
'react/prop-types': 0,
26-
'react-hooks/rules-of-hooks': 'error',
27-
'react-hooks/exhaustive-deps': 'error',
2812

2913
// typescript settings
30-
'@typescript-eslint/explicit-function-return-type': 0,
31-
'@typescript-eslint/no-explicit-any': 0,
32-
'@typescript-eslint/no-unused-vars': [
14+
// @see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/naming-convention.md#enforce-that-interface-names-do-not-begin-with-an-i
15+
'@typescript-eslint/naming-convention': [
3316
'error',
34-
{ argsIgnorePattern: '^_', ignoreRestSiblings: true },
35-
],
36-
'@typescript-eslint/interface-name-prefix': [
37-
2,
3817
{
39-
prefixWithI: 'always',
40-
allowUnderscorePrefix: true,
18+
selector: 'interface',
19+
format: ['PascalCase'],
20+
leadingUnderscore: 'allow',
21+
custom: {
22+
regex: '^I[A-Z]',
23+
match: true,
24+
},
4125
},
4226
],
27+
// removed
28+
'@typescript-eslint/interface-name-prefix': 0,
29+
// note you must disable the base rule as it can report incorrect errors
30+
'no-use-before-define': 'off',
31+
'@typescript-eslint/no-use-before-define': ['error'],
4332
},
4433
overrides: [
4534
{
@@ -62,14 +51,4 @@ module.exports = {
6251
},
6352
},
6453
],
65-
settings: {
66-
'import/resolver': {
67-
node: {
68-
extensions: ['.js', '.jsx', '.ts', '.tsx', '.d.ts'],
69-
},
70-
},
71-
react: {
72-
version: 'detect', // Tells eslint-plugin-react to automatically detect the version of React to use
73-
},
74-
},
7554
}

.travis.yml

+11-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ language: node_js
33
env:
44
global:
55
- YARN_VERSION="1.21.1"
6+
- NODE_VERSION="12.16.0"
67

78
node_js:
8-
- "node"
9+
- $NODE_VERSION
910

1011
before_install:
1112
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version $YARN_VERSION
@@ -14,9 +15,17 @@ before_install:
1415
install:
1516
- yarn
1617

18+
# if before_script returns a non-zero exit code, the build is errored and stops
19+
# immediately.
20+
before_script:
21+
- yarn build
22+
- yarn lint-js --max-warnings=0
23+
- yarn lint-ts
24+
25+
# If script returns a non-zero exit code, the build is failed, but continues to
26+
# run before being marked as failed.
1727
script:
1828
- yarn test
19-
- yarn build
2029
- yarn size
2130

2231
notifications:

README.md

+9-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ clients, sites, ...).
1616

1717
## Getting started
1818

19-
```sh
19+
```bash
2020
npm i react-component-catalog --save
2121

2222
# or
@@ -26,13 +26,13 @@ yarn add react-component-catalog
2626
Then install the correct versions of each peerDependency package, which are
2727
listed by the command:
2828

29-
```sh
29+
```bash
3030
npm info "react-component-catalog@latest" peerDependencies
3131
```
3232

3333
If using npm 5+, use this shortcut:
3434

35-
```sh
35+
```bash
3636
npx install-peerdeps --dev react-component-catalog
3737

3838
# or
@@ -350,13 +350,13 @@ class App extends React.Component {
350350

351351
## How to build and test this package
352352

353-
```sh
353+
```bash
354354
# -- build the package --
355355
yarn
356356
yarn build
357357
```
358358

359-
```sh
359+
```bash
360360
# -- test the package in an example app --
361361
# run the example in watch-mode
362362
yarn watch
@@ -406,6 +406,8 @@ straightforward way. That is why, I decided to create it.
406406

407407
## Maintainers
408408

409+
<!-- prettier-ignore-start -->
410+
<!-- markdownlint-disable -->
409411
<table>
410412
<tbody>
411413
<tr>
@@ -424,3 +426,5 @@ straightforward way. That is why, I decided to create it.
424426
</tr>
425427
<tbody>
426428
</table>
429+
<!-- markdownlint-enable -->
430+
<!-- prettier-ignore-end -->

package.json

+55-50
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
"scripts": {
88
"build": "FORCE_COLOR=1 lerna run build --stream",
99
"coveralls": "FORCE_COLOR=1 lerna run coveralls --scope react-component-catalog",
10-
"lint": "yarn lint-eslint && yarn lint-tsc",
11-
"lint-eslint": "eslint --cache 'packages/**/*.{ts,tsx}' --quiet",
12-
"lint-tsc": "tsc --noEmit",
10+
"lint": "yarn lint-js && yarn lint-ts",
11+
"lint-js": "eslint --cache --quiet 'packages/**/*.{ts,tsx}'",
12+
"lint-ts": "tsc --project tsconfig.test.json",
1313
"prepublishOnly": "yarn release",
1414
"prerelease": "yarn build && yarn size && yarn test",
1515
"release": "HUSKY_SKIP_HOOKS=1 standard-version",
@@ -21,62 +21,61 @@
2121
"watch": "FORCE_COLOR=1 lerna run watch --scope react-component-catalog-example --stream"
2222
},
2323
"devDependencies": {
24-
"@babel/cli": "7.10.5",
25-
"@babel/core": "7.10.5",
26-
"@babel/plugin-proposal-class-properties": "7.10.4",
27-
"@babel/plugin-proposal-object-rest-spread": "7.10.4",
28-
"@babel/plugin-transform-modules-commonjs": "7.10.4",
29-
"@babel/preset-env": "7.10.4",
30-
"@babel/preset-react": "7.10.4",
31-
"@babel/preset-typescript": "7.10.4",
32-
"@babel/runtime-corejs3": "7.10.5",
33-
"@size-limit/preset-small-lib": "4.5.5",
24+
"@babel/cli": "7.12.1",
25+
"@babel/core": "7.12.3",
26+
"@babel/plugin-proposal-class-properties": "7.12.1",
27+
"@babel/plugin-proposal-object-rest-spread": "7.12.1",
28+
"@babel/plugin-transform-modules-commonjs": "7.12.1",
29+
"@babel/preset-env": "7.12.1",
30+
"@babel/preset-react": "7.12.1",
31+
"@babel/preset-typescript": "7.12.1",
32+
"@babel/runtime-corejs3": "7.12.1",
33+
"@size-limit/preset-small-lib": "4.6.2",
3434
"@types/enzyme": "3.10.5",
3535
"@types/enzyme-adapter-react-16": "1.0.6",
36-
"@types/jest": "25.1.2",
36+
"@types/jest": "26.0.15",
3737
"@types/react": "16.9.43",
3838
"@types/react-dom": "16.9.8",
39-
"@typescript-eslint/eslint-plugin": "2.19.2",
40-
"@typescript-eslint/parser": "2.19.2",
41-
"babel-eslint": "10.0.3",
39+
"@typescript-eslint/eslint-plugin": "4.6.0",
40+
"@typescript-eslint/parser": "4.6.0",
41+
"babel-eslint": "10.1.0",
4242
"babel-loader": "8.1.0",
4343
"babel-plugin-dev-expression": "0.2.2",
44-
"commitizen": "4.0.3",
44+
"commitizen": "4.2.2",
4545
"core-js": "3.6.5",
46-
"coveralls": "3.0.9",
47-
"cz-conventional-changelog": "3.1.0",
46+
"coveralls": "3.1.0",
47+
"cz-conventional-changelog": "3.3.0",
4848
"enzyme": "3.11.0",
49-
"enzyme-adapter-react-16": "1.15.2",
50-
"eslint": "6.8.0",
51-
"eslint-config-airbnb": "18.0.1",
52-
"eslint-config-ns": "1.1.0",
53-
"eslint-config-prettier": "6.10.0",
49+
"enzyme-adapter-react-16": "1.15.5",
50+
"eslint": "7.12.1",
51+
"eslint-config-airbnb": "18.2.0",
52+
"eslint-config-ns-ts": "1.3.0",
53+
"eslint-config-prettier": "6.15.0",
5454
"eslint-import-resolver-alias": "1.1.2",
55-
"eslint-plugin-import": "2.20.1",
56-
"eslint-plugin-jest": "23.7.0",
57-
"eslint-plugin-jsx-a11y": "6.2.3",
58-
"eslint-plugin-prettier": "3.1.2",
59-
"eslint-plugin-react": "7.18.3",
60-
"eslint-plugin-react-hooks": "2.3.0",
61-
"husky": "4.2.3",
62-
"jest": "25.1.0",
55+
"eslint-plugin-import": "2.22.1",
56+
"eslint-plugin-jest": "24.1.0",
57+
"eslint-plugin-jsx-a11y": "6.4.1",
58+
"eslint-plugin-prettier": "3.1.4",
59+
"eslint-plugin-react": "7.21.5",
60+
"eslint-plugin-react-hooks": "4.2.0",
61+
"husky": "4.3.0",
62+
"jest": "26.6.1",
6363
"lerna": "3.22.1",
64-
"lint-staged": "10.0.7",
65-
"nodemon": "2.0.4",
66-
"prettier": "1.19.1",
67-
"react": "16.8.3",
68-
"react-dom": "16.8.3",
64+
"lint-staged": "10.5.0",
65+
"nodemon": "2.0.6",
66+
"prettier": "2.1.2",
67+
"react": "^16.8.3",
68+
"react-dom": "^16.8.3",
6969
"rimraf": "3.0.2",
70-
"size-limit": "4.5.5",
71-
"source-map-loader": "0.2.4",
72-
"standard-version": "7.1.0",
73-
"terser-webpack-plugin": "2.3.5",
74-
"ts-jest": "25.2.0",
75-
"ts-loader": "6.2.2",
76-
"tsconfig-paths-webpack-plugin": "3.2.0",
77-
"typescript": "3.8.3",
78-
"webpack": "4.42.1",
79-
"webpack-cli": "3.3.11"
70+
"size-limit": "4.6.2",
71+
"standard-version": "9.0.0",
72+
"terser-webpack-plugin": "4.2.3",
73+
"ts-jest": "26.4.3",
74+
"ts-loader": "8.0.7",
75+
"tsconfig-paths-webpack-plugin": "3.3.0",
76+
"typescript": "4.0.5",
77+
"webpack": "4.44.2",
78+
"webpack-cli": "3.3.12"
8079
},
8180
"workspaces": [
8281
"packages/*"
@@ -88,8 +87,14 @@
8887
}
8988
},
9089
"lint-staged": {
91-
"*.{js,jsx,ts,tsx}": [
92-
"yarn run lint",
90+
"*.{js,jsx}": [
91+
"yarn run lint-js",
92+
"prettier --write",
93+
"git update-index --again",
94+
"jest --findRelatedTests"
95+
],
96+
"*.{ts,tsx}": [
97+
"yarn run lint-ts",
9398
"prettier --write",
9499
"git update-index --again",
95100
"jest --findRelatedTests"

packages/example/package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@
2121
"watch-server": "nodemon --watch src"
2222
},
2323
"dependencies": {
24-
"@babel/register": "7.9.0",
25-
"@babel/runtime-corejs3": "7.10.5",
26-
"@hapi/hapi": "19.2.0",
27-
"@hapi/inert": "6.0.1",
24+
"@babel/register": "7.12.1",
25+
"@babel/runtime-corejs3": "7.12.1",
26+
"@hapi/hapi": "20.0.1",
27+
"@hapi/inert": "6.0.3",
2828
"core-js": "3.6.5",
2929
"dotenv": "8.2.0",
30-
"react": "16.8.3",
30+
"react": "^16.8.3",
3131
"react-component-catalog": "2.0.0",
32-
"react-dom": "16.8.3",
32+
"react-dom": "^16.8.3",
3333
"regenerator-runtime": "0.13.7"
3434
},
3535
"repository": {

packages/react-component-catalog/src/__tests__/index.test.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import CatalogComponentPart from '../components/catalog-component'
22
import CatalogProviderPart from '../components/catalog-provider'
33
import withCatalogPart from '../components/with-catalog'
4-
54
import ReactComponentCatalog, {
65
CatalogComponent,
76
CatalogProvider,

packages/react-component-catalog/src/components/__tests__/catalog-component.server.test.tsx

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
/**
22
* @jest-environment node
33
*/
4-
import React from 'react'
4+
import React, { FunctionComponent } from 'react'
55
import { render } from 'enzyme'
66

77
import Catalog, { ICatalog } from '../../catalog'
88
import CatalogComponent from '../catalog-component'
99
import CatalogProvider from '../catalog-provider'
1010

11-
const TestComponent = () => <div>Hello World</div>
12-
const BaseArticle = () => <div>Hello BaseArticle</div>
11+
const TestComponent: FunctionComponent = () => <div>Hello World</div>
12+
const BaseArticle: FunctionComponent = () => <div>Hello BaseArticle</div>
13+
const EmptyComponent: FunctionComponent = () => <div />
1314

1415
describe('CatalogComponent', () => {
1516
let backupError: () => void
@@ -21,9 +22,9 @@ describe('CatalogComponent', () => {
2122
BaseArticle,
2223
},
2324
Pages: {
24-
NestedPage: () => <div />,
25+
NestedPage: EmptyComponent,
2526
AnotherNestedPage: {
26-
OtherPage: () => <div />,
27+
OtherPage: EmptyComponent,
2728
},
2829
},
2930
}

packages/react-component-catalog/src/components/catalog-component.tsx

+5-4
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ interface IProps<T> {
2323
* augmented it matches everything.
2424
* @see https://stackoverflow.com/a/58512513/1238150
2525
*/
26-
component: T extends Record<string, any>
26+
component: T extends Record<string, unknown>
2727
? keyof T
2828
: T extends (infer R)[]
2929
? R
3030
: T extends string
3131
? string
3232
: T extends CatalogComponents
3333
? keyof CatalogComponents
34-
: unknown
34+
: any
3535
/**
3636
* when no component is found, a fallbackComponent is rendered instead
3737
*/
@@ -70,8 +70,9 @@ const CatalogComponent = React.forwardRef<any, IProps<any>>((props, ref) => {
7070
return null
7171
}
7272

73-
// or catalog.getComponent<ComponentType<PropsWithRef<any>>>(component)
74-
const Component = catalog.getComponent(component)
73+
const Component = catalog.getComponent<ComponentType<PropsWithRef<any>>>(
74+
component,
75+
)
7576
if (Component) {
7677
return <Component {...others} ref={ref} />
7778
}

0 commit comments

Comments
 (0)