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

View File

@ -42,7 +42,7 @@
"stats": "webpack --env.standalone --json --profile --mode=production > stats.json",
"prettier": "prettier --write \"cli/index.ts\" \"src/**/*.{ts,tsx}\"",
"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",
"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",

View File

@ -29,7 +29,12 @@ export function ExternalExample({ example, mimeType }: ExampleProps) {
return (
<StyledPre>
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}
</a>
</StyledPre>

View File

@ -1,6 +1,3 @@
// @ts-ignore
import Dropdown from 'react-dropdown';
import { transparentize } from 'polished';
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 && (
<tr key="bearer">
<th> Bearer format </th>
<td> "{scheme.http.bearerFormat}" </td>
<td> &quot;{scheme.http.bearerFormat}&quot; </td>
</tr>
),
]
@ -105,7 +105,11 @@ export class SecurityDefs extends React.PureComponent<SecurityDefsProps> {
<tr>
<th> Connect URL </th>
<td>
<a target="_blank" href={scheme.openId.connectUrl}>
<a
target="_blank"
rel="noopener noreferrer"
href={scheme.openId.connectUrl}
>
{scheme.openId.connectUrl}
</a>
</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} />
<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
</a>
</RedocAttribution>

View File

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

View File

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

View File

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

View File

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

View File

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