mirror of
https://github.com/tenrok/OverlayScrollbars.git
synced 2026-06-20 16:00:36 +03:00
simplify eslint rules
This commit is contained in:
+36
-59
@@ -48,20 +48,49 @@ const defaultRules = {
|
|||||||
],
|
],
|
||||||
'react/jsx-filename-extension': ['error', { extensions: ['.jsx', '.tsx'] }],
|
'react/jsx-filename-extension': ['error', { extensions: ['.jsx', '.tsx'] }],
|
||||||
'react/require-default-props': ['off'],
|
'react/require-default-props': ['off'],
|
||||||
|
'no-shadow': 'off',
|
||||||
|
'@typescript-eslint/no-shadow': ['error'],
|
||||||
|
'no-use-before-define': 'off',
|
||||||
|
'@typescript-eslint/no-use-before-define': ['error'],
|
||||||
|
'no-redeclare': 'off',
|
||||||
|
'@typescript-eslint/no-redeclare': ['error', { ignoreDeclarationMerge: true }],
|
||||||
|
'no-unused-vars': 'off',
|
||||||
|
'@typescript-eslint/no-unused-vars': ['error'],
|
||||||
|
'@typescript-eslint/ban-ts-comment': 'off',
|
||||||
|
'@typescript-eslint/no-non-null-assertion': 'off',
|
||||||
|
'@typescript-eslint/no-explicit-any': 'off',
|
||||||
|
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||||
|
'@typescript-eslint/no-var-requires': 'off',
|
||||||
|
'@typescript-eslint/unbound-method': 'off',
|
||||||
|
'@typescript-eslint/consistent-type-imports': 'warn',
|
||||||
|
'@typescript-eslint/no-this-alias': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
allowDestructuring: true, // Allow `const { props, state } = this`; false by default
|
||||||
|
allowedNames: ['self', '_self'], // Allow `const self = this`; `[]` by default
|
||||||
|
},
|
||||||
|
],
|
||||||
};
|
};
|
||||||
const defaultExtends = ['airbnb', 'prettier', 'plugin:react/jsx-runtime'];
|
|
||||||
const defaultPlugins = ['prettier', 'json', '@typescript-eslint', 'import', 'react'];
|
const defaultPlugins = ['prettier', 'json', '@typescript-eslint', 'import', 'react'];
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
extends: defaultExtends,
|
extends: [
|
||||||
|
'prettier',
|
||||||
|
'eslint:recommended',
|
||||||
|
'plugin:react/jsx-runtime',
|
||||||
|
'plugin:@typescript-eslint/recommended',
|
||||||
|
],
|
||||||
plugins: defaultPlugins,
|
plugins: defaultPlugins,
|
||||||
|
ignorePatterns: ['.eslintrc.js'],
|
||||||
parser: '@typescript-eslint/parser',
|
parser: '@typescript-eslint/parser',
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
ecmaFeatures: {
|
tsconfigRootDir: __dirname,
|
||||||
jsx: true,
|
project: [
|
||||||
},
|
'./packages/**/tsconfig.json',
|
||||||
ecmaVersion: 11,
|
'./examples/**/tsconfig.json',
|
||||||
sourceType: 'module',
|
'./website/**/tsconfig.json',
|
||||||
|
'./local/**/tsconfig.json',
|
||||||
|
],
|
||||||
},
|
},
|
||||||
env: {
|
env: {
|
||||||
browser: true,
|
browser: true,
|
||||||
@@ -87,60 +116,9 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
rules: defaultRules,
|
rules: defaultRules,
|
||||||
overrides: [
|
overrides: [
|
||||||
{
|
|
||||||
files: ['*.ts', '*.tsx', '*.d.ts'],
|
|
||||||
extends: [...defaultExtends, 'plugin:@typescript-eslint/recommended'],
|
|
||||||
plugins: defaultPlugins,
|
|
||||||
parser: '@typescript-eslint/parser',
|
|
||||||
parserOptions: {
|
|
||||||
tsconfigRootDir: __dirname,
|
|
||||||
project: [
|
|
||||||
'./packages/**/tsconfig.json',
|
|
||||||
'./examples/**/tsconfig.json',
|
|
||||||
'./website/**/tsconfig.json',
|
|
||||||
'./local/**/tsconfig.json',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
rules: {
|
|
||||||
...defaultRules,
|
|
||||||
'no-shadow': 'off',
|
|
||||||
'@typescript-eslint/no-shadow': ['error'],
|
|
||||||
'no-use-before-define': 'off',
|
|
||||||
'@typescript-eslint/no-use-before-define': ['error'],
|
|
||||||
'no-redeclare': 'off',
|
|
||||||
'@typescript-eslint/no-redeclare': ['error', { ignoreDeclarationMerge: true }],
|
|
||||||
'no-unused-vars': 'off',
|
|
||||||
'@typescript-eslint/no-unused-vars': ['error'],
|
|
||||||
'@typescript-eslint/ban-ts-comment': 'off',
|
|
||||||
'@typescript-eslint/no-non-null-assertion': 'off',
|
|
||||||
'@typescript-eslint/no-explicit-any': 'off',
|
|
||||||
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
||||||
'@typescript-eslint/no-var-requires': 'off',
|
|
||||||
'@typescript-eslint/unbound-method': 'off',
|
|
||||||
'@typescript-eslint/consistent-type-imports': 'warn',
|
|
||||||
'@typescript-eslint/no-this-alias': [
|
|
||||||
'error',
|
|
||||||
{
|
|
||||||
allowDestructuring: true, // Allow `const { props, state } = this`; false by default
|
|
||||||
allowedNames: ['self', '_self'], // Allow `const self = this`; `[]` by default
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
files: ['*.test.*', '**/test/**/*'],
|
files: ['*.test.*', '**/test/**/*'],
|
||||||
extends: [...defaultExtends, 'plugin:@typescript-eslint/recommended'],
|
|
||||||
plugins: [...defaultPlugins, 'jest-dom'],
|
plugins: [...defaultPlugins, 'jest-dom'],
|
||||||
parser: '@typescript-eslint/parser',
|
|
||||||
parserOptions: {
|
|
||||||
tsconfigRootDir: __dirname,
|
|
||||||
project: [
|
|
||||||
'./packages/**/tsconfig.json',
|
|
||||||
'./examples/**/tsconfig.json',
|
|
||||||
'./website/**/tsconfig.json',
|
|
||||||
'./local/**/tsconfig.json',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
rules: {
|
rules: {
|
||||||
...defaultRules,
|
...defaultRules,
|
||||||
'no-shadow': 'off',
|
'no-shadow': 'off',
|
||||||
@@ -160,7 +138,6 @@ module.exports = {
|
|||||||
'no-void': 'off',
|
'no-void': 'off',
|
||||||
'no-empty-function': 'off',
|
'no-empty-function': 'off',
|
||||||
'no-new-func': 'off',
|
'no-new-func': 'off',
|
||||||
'import/order': 'off',
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
export interface OverlayScrollbarsComponentProps {
|
export interface OverlayScrollbarsComponentProps {
|
||||||
msg: string;
|
element?: string;
|
||||||
|
options?: {};
|
||||||
|
events?: {};
|
||||||
}
|
}
|
||||||
|
|
||||||
export const OverlayScrollbarsComponent = (props: OverlayScrollbarsComponentProps) => {
|
export const OverlayScrollbarsComponent = (props: OverlayScrollbarsComponentProps) => {
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import type { DeepPartial } from '~/typings';
|
|
||||||
import type { Options } from '~/options';
|
|
||||||
import { defaultOptions } from '~/options';
|
import { defaultOptions } from '~/options';
|
||||||
import type { Initialization } from '~/initialization';
|
|
||||||
import { getEnvironment } from '~/environment';
|
import { getEnvironment } from '~/environment';
|
||||||
import { ScrollbarsHidingPlugin, scrollbarsHidingPluginName } from '~/plugins';
|
import { ScrollbarsHidingPlugin, scrollbarsHidingPluginName } from '~/plugins';
|
||||||
|
import type { DeepPartial } from '~/typings';
|
||||||
|
import type { Options } from '~/options';
|
||||||
|
import type { Initialization } from '~/initialization';
|
||||||
|
|
||||||
const defaultInitialization = {
|
const defaultInitialization = {
|
||||||
elements: {
|
elements: {
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import type { Initialization } from '~/initialization';
|
|
||||||
import {
|
import {
|
||||||
staticInitializationElement,
|
staticInitializationElement,
|
||||||
dynamicInitializationElement,
|
dynamicInitializationElement,
|
||||||
cancelInitialization,
|
cancelInitialization,
|
||||||
} from '~/initialization';
|
} from '~/initialization';
|
||||||
import { getEnvironment } from '~/environment';
|
import { getEnvironment } from '~/environment';
|
||||||
|
import type { Initialization } from '~/initialization';
|
||||||
|
|
||||||
jest.mock('~/environment', () => ({
|
jest.mock('~/environment', () => ({
|
||||||
getEnvironment: jest.fn(() => jest.requireActual('~/environment').getEnvironment()),
|
getEnvironment: jest.fn(() => jest.requireActual('~/environment').getEnvironment()),
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import type { DeepPartial } from '~/typings';
|
|
||||||
import type { Options } from '~/options';
|
|
||||||
import { defaultOptions } from '~/options';
|
import { defaultOptions } from '~/options';
|
||||||
import { assignDeep } from '~/support';
|
import { assignDeep } from '~/support';
|
||||||
import { OptionsValidationPlugin } from '~/plugins';
|
import { OptionsValidationPlugin } from '~/plugins';
|
||||||
import { OverlayScrollbars as originalOverlayScrollbars } from '~/overlayscrollbars';
|
import { OverlayScrollbars as originalOverlayScrollbars } from '~/overlayscrollbars';
|
||||||
|
import type { Options } from '~/options';
|
||||||
|
import type { DeepPartial } from '~/typings';
|
||||||
|
|
||||||
const bodyElm = document.body;
|
const bodyElm = document.body;
|
||||||
const div = document.createElement('div');
|
const div = document.createElement('div');
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
|
import { optionsTemplateTypes as oTypes } from '~/plugins/optionsValidationPlugin/validation';
|
||||||
|
import { transformOptions } from '~/plugins/optionsValidationPlugin/transformation';
|
||||||
import type { PlainObject } from '~/typings';
|
import type { PlainObject } from '~/typings';
|
||||||
import type { OptionsTemplate } from '~/plugins/optionsValidationPlugin/validation';
|
import type { OptionsTemplate } from '~/plugins/optionsValidationPlugin/validation';
|
||||||
import { optionsTemplateTypes as oTypes } from '~/plugins/optionsValidationPlugin/validation';
|
|
||||||
import type { OptionsWithOptionsTemplate } from '~/plugins/optionsValidationPlugin/transformation';
|
import type { OptionsWithOptionsTemplate } from '~/plugins/optionsValidationPlugin/transformation';
|
||||||
import { transformOptions } from '~/plugins/optionsValidationPlugin/transformation';
|
|
||||||
|
|
||||||
type TestOptionsObj = { propA: 'propA'; null: null };
|
type TestOptionsObj = { propA: 'propA'; null: null };
|
||||||
type TestOptionsEnum = 'A' | 'B' | 'C';
|
type TestOptionsEnum = 'A' | 'B' | 'C';
|
||||||
|
|||||||
+1
-1
@@ -1,9 +1,9 @@
|
|||||||
import type { OptionsTemplate } from '~/plugins/optionsValidationPlugin/validation';
|
|
||||||
import {
|
import {
|
||||||
validateOptions,
|
validateOptions,
|
||||||
optionsTemplateTypes as oTypes,
|
optionsTemplateTypes as oTypes,
|
||||||
} from '~/plugins/optionsValidationPlugin/validation';
|
} from '~/plugins/optionsValidationPlugin/validation';
|
||||||
import { assignDeep } from '~/support/utils';
|
import { assignDeep } from '~/support/utils';
|
||||||
|
import type { OptionsTemplate } from '~/plugins/optionsValidationPlugin/validation';
|
||||||
|
|
||||||
type TestOptionsObj = { propA: 'propA'; null: null };
|
type TestOptionsObj = { propA: 'propA'; null: null };
|
||||||
type TestOptionsEnum = 'A' | 'B' | 'C';
|
type TestOptionsEnum = 'A' | 'B' | 'C';
|
||||||
|
|||||||
+6
-6
@@ -1,10 +1,4 @@
|
|||||||
import type {
|
|
||||||
ScrollbarsSetupElement,
|
|
||||||
ScrollbarsSetupElementsObj,
|
|
||||||
ScrollbarStructure,
|
|
||||||
} from '~/setups/scrollbarsSetup/scrollbarsSetup.elements';
|
|
||||||
import { createScrollbarsSetupElements } from '~/setups/scrollbarsSetup/scrollbarsSetup.elements';
|
import { createScrollbarsSetupElements } from '~/setups/scrollbarsSetup/scrollbarsSetup.elements';
|
||||||
import type { StructureSetupElementsObj } from '~/setups/structureSetup/structureSetup.elements';
|
|
||||||
import { createStructureSetupElements } from '~/setups/structureSetup/structureSetup.elements';
|
import { createStructureSetupElements } from '~/setups/structureSetup/structureSetup.elements';
|
||||||
import {
|
import {
|
||||||
classNameScrollbar,
|
classNameScrollbar,
|
||||||
@@ -14,6 +8,12 @@ import {
|
|||||||
classNameScrollbarHandle,
|
classNameScrollbarHandle,
|
||||||
classNamesScrollbarTransitionless,
|
classNamesScrollbarTransitionless,
|
||||||
} from '~/classnames';
|
} from '~/classnames';
|
||||||
|
import type { StructureSetupElementsObj } from '~/setups/structureSetup/structureSetup.elements';
|
||||||
|
import type {
|
||||||
|
ScrollbarsSetupElement,
|
||||||
|
ScrollbarsSetupElementsObj,
|
||||||
|
ScrollbarStructure,
|
||||||
|
} from '~/setups/scrollbarsSetup/scrollbarsSetup.elements';
|
||||||
import type { InitializationTarget } from '~/initialization';
|
import type { InitializationTarget } from '~/initialization';
|
||||||
|
|
||||||
jest.useFakeTimers();
|
jest.useFakeTimers();
|
||||||
|
|||||||
+2
-2
@@ -5,11 +5,11 @@ import {
|
|||||||
classNameViewport,
|
classNameViewport,
|
||||||
classNameContent,
|
classNameContent,
|
||||||
} from '~/classnames';
|
} from '~/classnames';
|
||||||
import type { InternalEnvironment } from '~/environment';
|
|
||||||
import { getEnvironment } from '~/environment';
|
import { getEnvironment } from '~/environment';
|
||||||
import type { StructureSetupElementsObj } from '~/setups/structureSetup/structureSetup.elements';
|
|
||||||
import { createStructureSetupElements } from '~/setups/structureSetup/structureSetup.elements';
|
import { createStructureSetupElements } from '~/setups/structureSetup/structureSetup.elements';
|
||||||
import { addPlugin, ScrollbarsHidingPlugin } from '~/plugins';
|
import { addPlugin, ScrollbarsHidingPlugin } from '~/plugins';
|
||||||
|
import type { StructureSetupElementsObj } from '~/setups/structureSetup/structureSetup.elements';
|
||||||
|
import type { InternalEnvironment } from '~/environment';
|
||||||
import type {
|
import type {
|
||||||
Initialization,
|
Initialization,
|
||||||
InitializationTarget,
|
InitializationTarget,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { OnOptions } from '~/support/dom/events';
|
|
||||||
import { off, preventDefault, stopPropagation, stopAndPrevent } from '~/support/dom/events';
|
import { off, preventDefault, stopPropagation, stopAndPrevent } from '~/support/dom/events';
|
||||||
|
import type { OnOptions } from '~/support/dom/events';
|
||||||
|
|
||||||
const testElm = document.body;
|
const testElm = document.body;
|
||||||
const mockEventListener = (
|
const mockEventListener = (
|
||||||
|
|||||||
@@ -10,10 +10,10 @@ import {
|
|||||||
setTestResult,
|
setTestResult,
|
||||||
waitForOrFailTest,
|
waitForOrFailTest,
|
||||||
} from '@~local/browser-testing';
|
} from '@~local/browser-testing';
|
||||||
import type { WH } from '~/support';
|
|
||||||
import { hasDimensions, offsetSize, style } from '~/support';
|
import { hasDimensions, offsetSize, style } from '~/support';
|
||||||
import { addPlugin, SizeObserverPlugin } from '~/plugins';
|
import { addPlugin, SizeObserverPlugin } from '~/plugins';
|
||||||
import { createSizeObserver } from '~/observers';
|
import { createSizeObserver } from '~/observers';
|
||||||
|
import type { WH } from '~/support';
|
||||||
|
|
||||||
if (!window.ResizeObserver) {
|
if (!window.ResizeObserver) {
|
||||||
addPlugin(SizeObserverPlugin);
|
addPlugin(SizeObserverPlugin);
|
||||||
|
|||||||
+3
-3
@@ -12,7 +12,6 @@ import {
|
|||||||
setTestResult,
|
setTestResult,
|
||||||
waitForOrFailTest,
|
waitForOrFailTest,
|
||||||
} from '@~local/browser-testing';
|
} from '@~local/browser-testing';
|
||||||
import type { WH } from '~/support';
|
|
||||||
import {
|
import {
|
||||||
assignDeep,
|
assignDeep,
|
||||||
clientSize,
|
clientSize,
|
||||||
@@ -30,14 +29,15 @@ import {
|
|||||||
removeElements,
|
removeElements,
|
||||||
removeClass,
|
removeClass,
|
||||||
} from '~/support';
|
} from '~/support';
|
||||||
import type { Options } from '~/options';
|
|
||||||
import type { DeepPartial } from '~/typings';
|
|
||||||
import {
|
import {
|
||||||
addPlugin,
|
addPlugin,
|
||||||
ScrollbarsHidingPlugin,
|
ScrollbarsHidingPlugin,
|
||||||
SizeObserverPlugin,
|
SizeObserverPlugin,
|
||||||
ClickScrollPlugin,
|
ClickScrollPlugin,
|
||||||
} from '~/plugins';
|
} from '~/plugins';
|
||||||
|
import type { WH } from '~/support';
|
||||||
|
import type { Options } from '~/options';
|
||||||
|
import type { DeepPartial } from '~/typings';
|
||||||
|
|
||||||
addPlugin(ClickScrollPlugin);
|
addPlugin(ClickScrollPlugin);
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
import { playwrightRollup, expectSuccess } from '@~local/playwright-tooling';
|
import { playwrightRollup, expectSuccess } from '@~local/playwright-tooling';
|
||||||
import type { Page } from '@playwright/test';
|
|
||||||
import { test } from '@playwright/test';
|
import { test } from '@playwright/test';
|
||||||
|
import type { Page } from '@playwright/test';
|
||||||
|
|
||||||
playwrightRollup();
|
playwrightRollup();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user