Skip to content

Commit f46d115

Browse files
authored
chore: setup ESLint and bump deps (#95)
* chore: setup ESLint and bump deps * chore: manually address ESLint errors * chore: use stringify * revert: terser
1 parent 8b80e97 commit f46d115

Some content is hidden

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

48 files changed

+3272
-1990
lines changed

.eslintrc

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"extends": "@stoplight",
3+
"parser": "@typescript-eslint/parser",
4+
"parserOptions": {
5+
"project": "./tsconfig.json"
6+
},
7+
"rules": {
8+
"no-param-reassign": "off",
9+
"@typescript-eslint/prefer-nullish-coalescing": "error",
10+
"@typescript-eslint/prefer-for-of": "error",
11+
"@typescript-eslint/no-throw-literal": "error",
12+
"@typescript-eslint/prefer-optional-chain": "error",
13+
"@typescript-eslint/no-floating-promises": ["error", { "ignoreVoid": true }],
14+
"no-console": "warn"
15+
},
16+
"overrides": [
17+
{
18+
"files": ["*.spec.{ts,tsx}"],
19+
"env": {
20+
"jest": true
21+
}
22+
}
23+
]
24+
}

.prettierrc.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
...require('@stoplight/eslint-config/prettier.config'),
3+
};

__mocks__/react.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// https://github.com/airbnb/enzyme/issues/1875#issuecomment-451177239
2-
const r = require.requireActual('react');
2+
const r = jest.requireActual('react');
33

44
module.exports = {
55
...r,

package.json

Lines changed: 37 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"build": "sl-scripts bundle --sourcemap",
2424
"build.docs": "build-storybook -c .storybook -o docs-auto",
2525
"commit": "git-cz",
26-
"lint": "tslint -c tslint.json -p tsconfig.json 'src/**/*.{ts,tsx}'",
26+
"lint": "eslint 'src/**/*.{ts,tsx}'",
2727
"lint.fix": "yarn lint --fix",
2828
"release": "sl-scripts release",
2929
"release.docs": "sl-scripts release:docs",
@@ -35,62 +35,65 @@
3535
"test.watch": "yarn test --watch"
3636
},
3737
"peerDependencies": {
38-
"@stoplight/markdown-viewer": "^3",
38+
"@stoplight/markdown-viewer": "^4",
3939
"@stoplight/ui-kit": "^3",
4040
"mobx": "^5",
4141
"react": ">=16.8",
4242
"react-dom": ">=16.8"
4343
},
4444
"dependencies": {
45-
"@stoplight/json": "^3.5.1",
45+
"@stoplight/json": "^3.10.0",
4646
"@stoplight/json-schema-merge-allof": "^0.7.2",
4747
"@stoplight/react-error-boundary": "^1.0.0",
4848
"@stoplight/tree-list": "^5.0.3",
4949
"classnames": "^2.2.6",
5050
"lodash": "^4.17.15",
51-
"mobx-react-lite": "^1.4.1",
52-
"pluralize": "^8.0.0"
51+
"mobx-react-lite": "^1.4.1"
5352
},
5453
"devDependencies": {
55-
"@emotion/core": "^10.0.16",
56-
"@emotion/styled": "^10.0.15",
5754
"@rollup/plugin-commonjs": "^11.1.0",
5855
"@rollup/plugin-typescript": "^3.1.1",
5956
"@sambego/storybook-state": "^1.3.6",
60-
"@stoplight/markdown-viewer": "^3.5.5",
57+
"@stoplight/eslint-config": "^1.2.0",
58+
"@stoplight/markdown-viewer": "^4.3.2",
6159
"@stoplight/scripts": "^8.2.0",
62-
"@stoplight/storybook-config": "^2.0.5",
63-
"@stoplight/types": "11.0.0",
64-
"@stoplight/ui-kit": "3.0.0-beta.2",
65-
"@types/classnames": "^2.2.9",
66-
"@types/enzyme": "3.10.3",
67-
"@types/jest": "^24.0.18",
68-
"@types/json-schema": "^7.0.3",
69-
"@types/lodash": "^4.14.149",
60+
"@stoplight/storybook-config": "^2.0.6",
61+
"@stoplight/types": "^11.9.0",
62+
"@stoplight/ui-kit": "3.0.0-beta.39",
63+
"@types/classnames": "^2.2.11",
64+
"@types/enzyme": "^3.10.8",
65+
"@types/jest": "^26.0.18",
66+
"@types/json-schema": "^7.0.6",
67+
"@types/lodash": "^4.14.165",
7068
"@types/node": "^12.7.2",
71-
"@types/pluralize": "^0.0.29",
7269
"@types/react": "16.9.2",
7370
"@types/react-dom": "16.9.0",
7471
"@types/treeify": "^1.0.0",
75-
"babel-jest": "^24.9.0",
76-
"babel-loader": "^8.0.6",
77-
"copyfiles": "^2.1.1",
78-
"emotion-theming": "^10.0.14",
79-
"enzyme": "3.10.0",
80-
"enzyme-adapter-react-16": "1.14.0",
81-
"enzyme-to-json": "3.4.0",
82-
"jest": "^24.9.0",
83-
"jest-enzyme": "7.1.0",
72+
"@typescript-eslint/eslint-plugin": "^4.9.1",
73+
"@typescript-eslint/parser": "^4.9.1",
74+
"babel-jest": "^26.6.3",
75+
"babel-loader": "^8.2.2",
76+
"copyfiles": "^2.4.1",
77+
"enzyme": "^3.11.0",
78+
"enzyme-adapter-react-16": "^1.15.5",
79+
"enzyme-to-json": "^3.6.1",
80+
"eslint": "^7.15.0",
81+
"eslint-plugin-import": "^2.20.2",
82+
"eslint-plugin-jest": "^24.1.3",
83+
"eslint-plugin-prettier": "^3.1.3",
84+
"eslint-plugin-react": "^7.21.5",
85+
"eslint-plugin-react-hooks": "^4.2.0",
86+
"eslint-plugin-simple-import-sort": "^5.0.2",
87+
"jest": "^26.6.2",
88+
"jest-enzyme": "7.1.2",
8489
"mobx": "^5.13.0",
85-
"prettier": "^1.19.1",
86-
"react": "16.9.0",
87-
"react-dom": "16.9.0",
90+
"prettier": "^2.2.1",
91+
"react": "^16.14.0",
92+
"react-dom": "^16.14.0",
8893
"rollup-plugin-terser": "^5.3.0",
8994
"treeify": "^1.1.0",
90-
"ts-jest": "^24.0.2",
91-
"tslint": "^5.19.0",
92-
"tslint-config-stoplight": "^1.4.0",
93-
"typescript": "^4.0.3"
95+
"ts-jest": "^26.4.4",
96+
"typescript": "^4.0.5"
9497
},
9598
"lint-staged": {
9699
"*.{ts,tsx}$": [
@@ -116,10 +119,5 @@
116119
"release": {
117120
"extends": "@stoplight/scripts/release"
118121
},
119-
"typings": "src/index.d.ts",
120-
"prettier": {
121-
"printWidth": 120,
122-
"trailingComma": "es5",
123-
"singleQuote": true
124-
}
122+
"typings": "src/index.d.ts"
125123
}

rollup.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import * as path from 'path';
1+
import commonjs from '@rollup/plugin-commonjs';
22
import typescript from '@rollup/plugin-typescript';
3+
import * as path from 'path';
34
import { terser } from 'rollup-plugin-terser';
4-
import commonjs from '@rollup/plugin-commonjs';
55

66
const BASE_PATH = process.cwd();
77

src/__stories__/JsonSchemaViewer.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
import * as React from 'react';
2-
31
import { Button, Checkbox, Icon } from '@stoplight/ui-kit';
42
import { action } from '@storybook/addon-actions';
53
import { boolean, number, object, select, text, withKnobs } from '@storybook/addon-knobs';
64
import { storiesOf } from '@storybook/react';
75
import { JSONSchema4 } from 'json-schema';
6+
import * as React from 'react';
7+
88
import { JsonSchemaViewer, RowRenderer, SchemaRow } from '../';
9+
import { Wrapper } from './utils/Wrapper';
910

1011
const allOfSchemaResolved = require('../__fixtures__/allOf/allOf-resolved.json');
1112
const schema = require('../__fixtures__/default-schema.json');
1213
const stressSchema = require('../__fixtures__/stress-schema.json');
13-
import { Wrapper } from './utils/Wrapper';
1414

1515
storiesOf('JsonSchemaViewer', module)
1616
.addDecorator(withKnobs)

0 commit comments

Comments
 (0)