chore: fix lint issues

This commit is contained in:
Roman Hotsiy 2020-03-17 13:18:23 +02:00
parent 54eb2a0dce
commit 7ba3de2e28
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0
11 changed files with 27 additions and 14 deletions

View File

@ -7,6 +7,7 @@ module.exports = {
parserOptions: { parserOptions: {
project: 'tsconfig.json', project: 'tsconfig.json',
sourceType: 'module', sourceType: 'module',
createDefaultProgram: true,
ecmaFeatures: { ecmaFeatures: {
jsx: true, jsx: true,
}, },
@ -37,6 +38,9 @@ module.exports = {
'react-dom/*', 'react-dom/*',
'core-js/**', 'core-js/**',
'memoize-one/**', 'memoize-one/**',
'unfetch/**',
'raf/polyfill',
'**/fixtures/**', // for tests
], ],
}, },
], ],

View File

@ -42,7 +42,7 @@
"stats": "webpack --env.standalone --json --profile --mode=production > stats.json", "stats": "webpack --env.standalone --json --profile --mode=production > stats.json",
"prettier": "prettier --write \"cli/index.ts\" \"src/**/*.{ts,tsx}\"", "prettier": "prettier --write \"cli/index.ts\" \"src/**/*.{ts,tsx}\"",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 1", "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 1",
"lint": "eslint src/**/*.{js,ts,tsx}", "lint": "eslint 'src/**/*.{js,ts,tsx}'",
"benchmark": "node ./benchmark/benchmark.js", "benchmark": "node ./benchmark/benchmark.js",
"start:demo": "webpack-dev-server --hot --config demo/webpack.config.ts --mode=development", "start:demo": "webpack-dev-server --hot --config demo/webpack.config.ts --mode=development",
"compile:cli": "tsc custom.d.ts cli/index.ts --target es6 --module commonjs --types yargs", "compile:cli": "tsc custom.d.ts cli/index.ts --target es6 --module commonjs --types yargs",

View File

@ -29,7 +29,12 @@ export function ExternalExample({ example, mimeType }: ExampleProps) {
return ( return (
<StyledPre> <StyledPre>
Error loading external example: <br /> Error loading external example: <br />
<a className={'token string'} href={example.externalValueUrl} target="_blank"> <a
className={'token string'}
href={example.externalValueUrl}
target="_blank"
rel="noopener noreferrer"
>
{example.externalValueUrl} {example.externalValueUrl}
</a> </a>
</StyledPre> </StyledPre>

View File

@ -1,6 +1,3 @@
// @ts-ignore
import Dropdown from 'react-dropdown';
import { transparentize } from 'polished'; import { transparentize } from 'polished';
import styled from '../../styled-components'; import styled from '../../styled-components';

View File

@ -97,7 +97,7 @@ export class SecurityDefs extends React.PureComponent<SecurityDefsProps> {
scheme.http.scheme === 'bearer' && scheme.http.bearerFormat && ( scheme.http.scheme === 'bearer' && scheme.http.bearerFormat && (
<tr key="bearer"> <tr key="bearer">
<th> Bearer format </th> <th> Bearer format </th>
<td> "{scheme.http.bearerFormat}" </td> <td> &quot;{scheme.http.bearerFormat}&quot; </td>
</tr> </tr>
), ),
] ]
@ -105,7 +105,11 @@ export class SecurityDefs extends React.PureComponent<SecurityDefsProps> {
<tr> <tr>
<th> Connect URL </th> <th> Connect URL </th>
<td> <td>
<a target="_blank" href={scheme.openId.connectUrl}> <a
target="_blank"
rel="noopener noreferrer"
href={scheme.openId.connectUrl}
>
{scheme.openId.connectUrl} {scheme.openId.connectUrl}
</a> </a>
</td> </td>

View File

@ -25,7 +25,7 @@ export class SideMenu extends React.Component<{ menu: MenuStore; className?: str
> >
<MenuItems items={store.items} onActivate={this.activate} root={true} /> <MenuItems items={store.items} onActivate={this.activate} root={true} />
<RedocAttribution> <RedocAttribution>
<a target="_blank" href="https://github.com/Redocly/redoc"> <a target="_blank" rel="noopener noreferrer" href="https://github.com/Redocly/redoc">
Documentation Powered by ReDoc Documentation Powered by ReDoc
</a> </a>
</RedocAttribution> </RedocAttribution>

View File

@ -1,3 +1,4 @@
/* eslint-disable import/no-internal-modules */
/* tslint:disable:no-implicit-dependencies */ /* tslint:disable:no-implicit-dependencies */
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';

View File

@ -8,6 +8,7 @@ describe('Models', () => {
let parser; let parser;
test('should hoist oneOfs when mergin allOf', () => { test('should hoist oneOfs when mergin allOf', () => {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const spec = require('./fixtures/oneOfHoist.json'); const spec = require('./fixtures/oneOfHoist.json');
parser = new OpenAPIParser(spec, undefined, opts); parser = new OpenAPIParser(spec, undefined, opts);
expect(parser.mergeAllOf(spec.components.schemas.test)).toMatchSnapshot(); expect(parser.mergeAllOf(spec.components.schemas.test)).toMatchSnapshot();

View File

@ -6,9 +6,9 @@ const opts = new RedocNormalizedOptions({});
describe('Models', () => { describe('Models', () => {
describe('FieldModel', () => { describe('FieldModel', () => {
let parser; // eslint-disable-next-line @typescript-eslint/no-var-requires
const spec = require('../fixtures/fields.json'); const spec = require('../fixtures/fields.json');
parser = new OpenAPIParser(spec, undefined, opts); const parser = new OpenAPIParser(spec, undefined, opts);
test('basic field details', () => { test('basic field details', () => {
const field = new FieldModel( const field = new FieldModel(

View File

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-var-requires */
import { SchemaModel } from '../../models/Schema'; import { SchemaModel } from '../../models/Schema';
import { OpenAPIParser } from '../../OpenAPIParser'; import { OpenAPIParser } from '../../OpenAPIParser';
import { RedocNormalizedOptions } from '../../RedocNormalizedOptions'; import { RedocNormalizedOptions } from '../../RedocNormalizedOptions';

View File

@ -640,7 +640,7 @@ describe('Utils', () => {
describe('OpenAPI sortByRequired', () => { describe('OpenAPI sortByRequired', () => {
it('should equal to the old data when all items have no required props', () => { it('should equal to the old data when all items have no required props', () => {
let fields = [ const fields = [
{ {
name: 'loginName', name: 'loginName',
required: false, required: false,
@ -694,7 +694,7 @@ describe('Utils', () => {
}); });
it('other item should be the same order when some of items are required', () => { it('other item should be the same order when some of items are required', () => {
let fields = [ const fields = [
{ {
name: 'loginName', name: 'loginName',
required: true, required: true,
@ -744,7 +744,7 @@ describe('Utils', () => {
required: false, required: false,
}, },
]; ];
let sortedFields = [ const sortedFields = [
{ {
name: 'loginName', name: 'loginName',
required: true, required: true,
@ -798,7 +798,7 @@ describe('Utils', () => {
}); });
it('should the order of required items is as same as the order parameter ', () => { it('should the order of required items is as same as the order parameter ', () => {
let fields = [ const fields = [
{ {
name: 'loginName', name: 'loginName',
required: true, required: true,