mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-10 19:06:34 +03:00
chore: enable tslint for test files
This commit is contained in:
parent
9115be8378
commit
08253ee1b1
|
@ -1,7 +1,9 @@
|
|||
/* tslint:disable:no-implicit-dependencies */
|
||||
|
||||
import * as React from 'react';
|
||||
import { renderToString } from 'react-dom/server';
|
||||
import { Redoc, createStore } from '../';
|
||||
import * as yaml from 'yaml-js';
|
||||
import { createStore, Redoc } from '../';
|
||||
|
||||
import { readFileSync } from 'fs';
|
||||
import { resolve } from 'path';
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import * as React from 'react';
|
||||
/* tslint:disable:no-implicit-dependencies */
|
||||
import { mount } from 'enzyme';
|
||||
import * as React from 'react';
|
||||
import * as yaml from 'yaml-js';
|
||||
|
||||
import { readFileSync } from 'fs';
|
||||
|
@ -7,14 +8,14 @@ import { resolve } from 'path';
|
|||
|
||||
// import { filterPropsDeep } from '../../../utils/test-utils';
|
||||
|
||||
import { RedocStandalone, Loading, StoreProvider, ErrorBoundary } from '../components/';
|
||||
import { ErrorBoundary, Loading, RedocStandalone, StoreProvider } from '../components/';
|
||||
|
||||
describe('Components', () => {
|
||||
describe('RedocStandalone', () => {
|
||||
test('should show loading first', () => {
|
||||
const spec = yaml.load(readFileSync(resolve(__dirname, '../../demo/openapi.yaml')));
|
||||
|
||||
let inst = mount(<RedocStandalone spec={spec} options={{}} />);
|
||||
const inst = mount(<RedocStandalone spec={spec} options={{}} />);
|
||||
expect(inst.find(Loading)).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
import * as React from 'react';
|
||||
/* tslint:disable:no-implicit-dependencies */
|
||||
|
||||
import { shallow } from 'enzyme';
|
||||
import toJson from 'enzyme-to-json';
|
||||
import * as React from 'react';
|
||||
|
||||
import { filterPropsDeep } from '../../utils/test-utils';
|
||||
|
||||
import { RedocNormalizedOptions } from '../../services/RedocNormalizedOptions';
|
||||
import { ObjectSchema, Schema } from '../';
|
||||
import { OpenAPIParser, SchemaModel } from '../../services';
|
||||
import { Schema, ObjectSchema } from '../';
|
||||
import { RedocNormalizedOptions } from '../../services/RedocNormalizedOptions';
|
||||
import * as simpleDiscriminatorFixture from './fixtures/simple-discriminator.json';
|
||||
|
||||
const options = new RedocNormalizedOptions({});
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
import * as React from 'react';
|
||||
/* tslint:disable:no-implicit-dependencies */
|
||||
|
||||
import { mount, ReactWrapper } from 'enzyme';
|
||||
import * as React from 'react';
|
||||
|
||||
import { JsonViewer } from '../';
|
||||
import { withTheme } from '../testProviders';
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
import * as React from 'react';
|
||||
/* tslint:disable:no-implicit-dependencies */
|
||||
|
||||
import { shallow } from 'enzyme';
|
||||
import toJson from 'enzyme-to-json';
|
||||
import * as React from 'react';
|
||||
|
||||
import { filterPropsDeep } from '../../utils/test-utils';
|
||||
|
||||
import { RedocNormalizedOptions } from '../../services/RedocNormalizedOptions';
|
||||
import { OneOfSchema, Schema } from '../';
|
||||
import { OpenAPIParser, SchemaModel } from '../../services';
|
||||
import { Schema, OneOfSchema } from '../';
|
||||
import { RedocNormalizedOptions } from '../../services/RedocNormalizedOptions';
|
||||
|
||||
const options = new RedocNormalizedOptions({});
|
||||
describe('Components', () => {
|
||||
|
|
|
@ -1,20 +1,24 @@
|
|||
/* tslint:disable:no-implicit-dependencies */
|
||||
|
||||
import { has, set } from 'lodash';
|
||||
import { instanceOf } from 'prop-types';
|
||||
import { RedocNormalizedOptions } from '../services/RedocNormalizedOptions';
|
||||
import { set, has } from 'lodash';
|
||||
|
||||
function traverseComponent(root, fn) {
|
||||
if (!root) return;
|
||||
if (!root) {
|
||||
return;
|
||||
}
|
||||
|
||||
fn(root);
|
||||
|
||||
if (root.children) {
|
||||
for (let child of root.children) {
|
||||
for (const child of root.children) {
|
||||
traverseComponent(child, fn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function filterPropsDeep<T extends Object>(component: T, paths: string[]): T {
|
||||
export function filterPropsDeep<T extends object>(component: T, paths: string[]): T {
|
||||
traverseComponent(component, comp => {
|
||||
if (comp.props) {
|
||||
for (const path of paths) {
|
||||
|
|
|
@ -36,8 +36,7 @@
|
|||
"include": [
|
||||
"./custom.d.ts",
|
||||
"./demo/playground/hmr-playground.tsx",
|
||||
"./src/index.ts",
|
||||
"./src/standalone.tsx",
|
||||
"./src/**/*.ts?",
|
||||
"demo/*.tsx"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
"quotemark": [true, "single", "avoid-template", "jsx-double"],
|
||||
"variable-name": [true, "ban-keywords", "check-format", "allow-leading-underscore", "allow-pascal-case"],
|
||||
"arrow-parens": [true, "ban-single-arg-parens"],
|
||||
"no-submodule-imports": [true, "prismjs", "perfect-scrollbar", "core-js"],
|
||||
"no-submodule-imports": [true, "prismjs", "perfect-scrollbar", "react-dom", "core-js"],
|
||||
"object-literal-key-quotes": [true, "as-needed"],
|
||||
"no-unused-expression": [true, "allow-tagged-template"],
|
||||
"semicolon": [true, "always", "ignore-bound-class-methods"],
|
||||
|
|
Loading…
Reference in New Issue
Block a user