Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update lint rules and remove import of lodash global object #175

Merged
merged 1 commit into from
Dec 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
{
"extends": ["@gravity-ui/eslint-config", "@gravity-ui/eslint-config/prettier"],
"root": true
"root": true,
"extends": [
"@gravity-ui/eslint-config",
"@gravity-ui/eslint-config/a11y",
"@gravity-ui/eslint-config/prettier",
"@gravity-ui/eslint-config/import-order"
],
"plugins": ["lodash"],
"rules": {
"lodash/import-scope": [2, "method"]
}
}
5 changes: 4 additions & 1 deletion demo/HtmlPreview.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import React from 'react';

import transform from '@diplodoc/transform';

import {MarkupString, colorClassName} from '../src';
import type {ClassNameProps} from '../src/classname';
import {colorClassName, MarkupString} from '../src';

import {plugins} from './md-plugins';

type PlaygroundHtmlPreviewProps = ClassNameProps & {
Expand Down
4 changes: 3 additions & 1 deletion demo/PMSelection.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React from 'react';

import type {EditorView} from 'prosemirror-view';
import {isTextSelection, isNodeSelection, isWholeSelection, ClassNameProps} from '../src';

import {ClassNameProps, isNodeSelection, isTextSelection, isWholeSelection} from '../src';

export type PMSelectionProps = ClassNameProps & {
view: EditorView;
Expand Down
3 changes: 2 additions & 1 deletion demo/Playground.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import React from 'react';
import {ComponentMeta, Story} from '@storybook/react';

import type {ComponentMeta, Story} from '@storybook/react'; // eslint-disable-line import/no-extraneous-dependencies

import {Playground as PlaygroundComponent, PlaygroundProps} from './Playground';
import {initialMdContent} from './md-content';

export default {
title: 'YFM Editor',
} as ComponentMeta<any>;

Check warning on line 10 in demo/Playground.stories.tsx

View workflow job for this annotation

GitHub Actions / Verify Files

Unexpected any. Specify a different type

type PlaygroundStoryProps = Pick<
PlaygroundProps,
Expand Down
21 changes: 11 additions & 10 deletions demo/Playground.tsx
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
import React from 'react';
import block from 'bem-cn-lite';
import {useUpdate} from 'react-use';

import {Button, RadioButton, TextArea} from '@gravity-ui/uikit';
import block from 'bem-cn-lite'; // eslint-disable-line import/no-extraneous-dependencies
import {useUpdate} from 'react-use';

import {
BaseNode,
BasePreset,
BehaviorPreset,
Extension,
FlexToolbar,
MarkdownBlocksPreset,
MarkdownMarksPreset,
MarkupString,
YfmEditorComponent,
useYfmEditor,
YfmPreset,
Extension,
ReactRenderStorage,
ReactRendererComponent,
FlexToolbar,
YfmEditorComponent,
YfmPreset,
logger,
useYfmEditor,
} from '../src';
import {wHiddenData, wToolbarConfig} from '../src/toolbar/config/wysiwyg';

import {PlaygroundHtmlPreview} from './HtmlPreview';
import {ProseMirrorDevTools} from './ProseMirrorDevTools';
import {PMSelection} from './PMSelection';
import {logger} from '../src/index';
import {ProseMirrorDevTools} from './ProseMirrorDevTools';
import {keys} from './keys';

import './Playground.scss';
import {keys} from './keys';

const b = block('playground');

Expand All @@ -44,8 +45,8 @@
}

logger.setLogger({
metrics: console.info,

Check warning on line 48 in demo/Playground.tsx

View workflow job for this annotation

GitHub Actions / Verify Files

Unexpected console statement
action: console.info,

Check warning on line 49 in demo/Playground.tsx

View workflow job for this annotation

GitHub Actions / Verify Files

Unexpected console statement
...console,
});

Expand Down
3 changes: 2 additions & 1 deletion demo/ProseMirrorDevTools.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {useEffect} from 'react';
import type {EditorView} from 'prosemirror-view';

import {applyDevTools, removeDevTools} from 'prosemirror-dev-toolkit';
import type {EditorView} from 'prosemirror-view';

export type ProseMirrorDevToolsProps = {
view: EditorView;
Expand Down
31 changes: 14 additions & 17 deletions demo/md-plugins.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,23 @@
import type {PluginWithParams} from 'markdown-it/lib';

import anchors from '@diplodoc/transform/lib/plugins/anchors';
import checkbox from '@diplodoc/transform/lib/plugins/checkbox';
import code from '@diplodoc/transform/lib/plugins/code';
import cut from '@diplodoc/transform/lib/plugins/cut';
import deflist from '@diplodoc/transform/lib/plugins/deflist';
import file from '@diplodoc/transform/lib/plugins/file';
import imsize from '@diplodoc/transform/lib/plugins/imsize';

import sub from 'markdown-it-sub';
import ins from 'markdown-it-ins';
import mark from 'markdown-it-mark';
import color from 'markdown-it-color';
import math from 'markdown-it-katex';

import meta from '@diplodoc/transform/lib/plugins/meta';
import checkbox from '@diplodoc/transform/lib/plugins/checkbox';
import deflist from '@diplodoc/transform/lib/plugins/deflist';
import anchors from '@diplodoc/transform/lib/plugins/anchors';
import cut from '@diplodoc/transform/lib/plugins/cut';
import monospace from '@diplodoc/transform/lib/plugins/monospace';
import notes from '@diplodoc/transform/lib/plugins/notes';
import tabs from '@diplodoc/transform/lib/plugins/tabs';
import code from '@diplodoc/transform/lib/plugins/code';
import sup from '@diplodoc/transform/lib/plugins/sup';
import video from '@diplodoc/transform/lib/plugins/video';
import monospace from '@diplodoc/transform/lib/plugins/monospace';
import yfmTable from '@diplodoc/transform/lib/plugins/table';
import tabs from '@diplodoc/transform/lib/plugins/tabs';
import video from '@diplodoc/transform/lib/plugins/video';
import type {PluginWithParams} from 'markdown-it/lib';
import color from 'markdown-it-color';
import ins from 'markdown-it-ins';
import math from 'markdown-it-katex';
import mark from 'markdown-it-mark';
import sub from 'markdown-it-sub';

const defaultPlugins: PluginWithParams[] = [
meta,
Expand Down
6 changes: 4 additions & 2 deletions demo/utils/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import React from 'react';
import type {Decorator} from '@storybook/react';
import {configure as configureUikit, ThemeProvider} from '@gravity-ui/uikit';

import {configure as configureComponents} from '@gravity-ui/components';
import {ThemeProvider, configure as configureUikit} from '@gravity-ui/uikit';
import type {Decorator} from '@storybook/react'; // eslint-disable-line import/no-extraneous-dependencies

import {configure as configureYfmEditor} from '../../src';

import '@gravity-ui/uikit/styles/styles.scss';
Expand Down
Loading
Loading