mirror of
https://github.com/tenrok/OverlayScrollbars.git
synced 2026-05-26 23:34:07 +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/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'];
|
||||
|
||||
module.exports = {
|
||||
extends: defaultExtends,
|
||||
extends: [
|
||||
'prettier',
|
||||
'eslint:recommended',
|
||||
'plugin:react/jsx-runtime',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
],
|
||||
plugins: defaultPlugins,
|
||||
ignorePatterns: ['.eslintrc.js'],
|
||||
parser: '@typescript-eslint/parser',
|
||||
parserOptions: {
|
||||
ecmaFeatures: {
|
||||
jsx: true,
|
||||
},
|
||||
ecmaVersion: 11,
|
||||
sourceType: 'module',
|
||||
tsconfigRootDir: __dirname,
|
||||
project: [
|
||||
'./packages/**/tsconfig.json',
|
||||
'./examples/**/tsconfig.json',
|
||||
'./website/**/tsconfig.json',
|
||||
'./local/**/tsconfig.json',
|
||||
],
|
||||
},
|
||||
env: {
|
||||
browser: true,
|
||||
@@ -87,60 +116,9 @@ module.exports = {
|
||||
},
|
||||
rules: defaultRules,
|
||||
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/**/*'],
|
||||
extends: [...defaultExtends, 'plugin:@typescript-eslint/recommended'],
|
||||
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: {
|
||||
...defaultRules,
|
||||
'no-shadow': 'off',
|
||||
@@ -160,7 +138,6 @@ module.exports = {
|
||||
'no-void': 'off',
|
||||
'no-empty-function': 'off',
|
||||
'no-new-func': 'off',
|
||||
'import/order': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
export interface OverlayScrollbarsComponentProps {
|
||||
msg: string;
|
||||
element?: string;
|
||||
options?: {};
|
||||
events?: {};
|
||||
}
|
||||
|
||||
export const OverlayScrollbarsComponent = (props: OverlayScrollbarsComponentProps) => {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import type { DeepPartial } from '~/typings';
|
||||
import type { Options } from '~/options';
|
||||
import { defaultOptions } from '~/options';
|
||||
import type { Initialization } from '~/initialization';
|
||||
import { getEnvironment } from '~/environment';
|
||||
import { ScrollbarsHidingPlugin, scrollbarsHidingPluginName } from '~/plugins';
|
||||
import type { DeepPartial } from '~/typings';
|
||||
import type { Options } from '~/options';
|
||||
import type { Initialization } from '~/initialization';
|
||||
|
||||
const defaultInitialization = {
|
||||
elements: {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import type { Initialization } from '~/initialization';
|
||||
import {
|
||||
staticInitializationElement,
|
||||
dynamicInitializationElement,
|
||||
cancelInitialization,
|
||||
} from '~/initialization';
|
||||
import { getEnvironment } from '~/environment';
|
||||
import type { Initialization } from '~/initialization';
|
||||
|
||||
jest.mock('~/environment', () => ({
|
||||
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 { assignDeep } from '~/support';
|
||||
import { OptionsValidationPlugin } from '~/plugins';
|
||||
import { OverlayScrollbars as originalOverlayScrollbars } from '~/overlayscrollbars';
|
||||
import type { Options } from '~/options';
|
||||
import type { DeepPartial } from '~/typings';
|
||||
|
||||
const bodyElm = document.body;
|
||||
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 { OptionsTemplate } from '~/plugins/optionsValidationPlugin/validation';
|
||||
import { optionsTemplateTypes as oTypes } from '~/plugins/optionsValidationPlugin/validation';
|
||||
import type { OptionsWithOptionsTemplate } from '~/plugins/optionsValidationPlugin/transformation';
|
||||
import { transformOptions } from '~/plugins/optionsValidationPlugin/transformation';
|
||||
|
||||
type TestOptionsObj = { propA: 'propA'; null: null };
|
||||
type TestOptionsEnum = 'A' | 'B' | 'C';
|
||||
|
||||
+1
-1
@@ -1,9 +1,9 @@
|
||||
import type { OptionsTemplate } from '~/plugins/optionsValidationPlugin/validation';
|
||||
import {
|
||||
validateOptions,
|
||||
optionsTemplateTypes as oTypes,
|
||||
} from '~/plugins/optionsValidationPlugin/validation';
|
||||
import { assignDeep } from '~/support/utils';
|
||||
import type { OptionsTemplate } from '~/plugins/optionsValidationPlugin/validation';
|
||||
|
||||
type TestOptionsObj = { propA: 'propA'; null: null };
|
||||
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 type { StructureSetupElementsObj } from '~/setups/structureSetup/structureSetup.elements';
|
||||
import { createStructureSetupElements } from '~/setups/structureSetup/structureSetup.elements';
|
||||
import {
|
||||
classNameScrollbar,
|
||||
@@ -14,6 +8,12 @@ import {
|
||||
classNameScrollbarHandle,
|
||||
classNamesScrollbarTransitionless,
|
||||
} 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';
|
||||
|
||||
jest.useFakeTimers();
|
||||
|
||||
+2
-2
@@ -5,11 +5,11 @@ import {
|
||||
classNameViewport,
|
||||
classNameContent,
|
||||
} from '~/classnames';
|
||||
import type { InternalEnvironment } from '~/environment';
|
||||
import { getEnvironment } from '~/environment';
|
||||
import type { StructureSetupElementsObj } from '~/setups/structureSetup/structureSetup.elements';
|
||||
import { createStructureSetupElements } from '~/setups/structureSetup/structureSetup.elements';
|
||||
import { addPlugin, ScrollbarsHidingPlugin } from '~/plugins';
|
||||
import type { StructureSetupElementsObj } from '~/setups/structureSetup/structureSetup.elements';
|
||||
import type { InternalEnvironment } from '~/environment';
|
||||
import type {
|
||||
Initialization,
|
||||
InitializationTarget,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { OnOptions } 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 mockEventListener = (
|
||||
|
||||
@@ -10,10 +10,10 @@ import {
|
||||
setTestResult,
|
||||
waitForOrFailTest,
|
||||
} from '@~local/browser-testing';
|
||||
import type { WH } from '~/support';
|
||||
import { hasDimensions, offsetSize, style } from '~/support';
|
||||
import { addPlugin, SizeObserverPlugin } from '~/plugins';
|
||||
import { createSizeObserver } from '~/observers';
|
||||
import type { WH } from '~/support';
|
||||
|
||||
if (!window.ResizeObserver) {
|
||||
addPlugin(SizeObserverPlugin);
|
||||
|
||||
+3
-3
@@ -12,7 +12,6 @@ import {
|
||||
setTestResult,
|
||||
waitForOrFailTest,
|
||||
} from '@~local/browser-testing';
|
||||
import type { WH } from '~/support';
|
||||
import {
|
||||
assignDeep,
|
||||
clientSize,
|
||||
@@ -30,14 +29,15 @@ import {
|
||||
removeElements,
|
||||
removeClass,
|
||||
} from '~/support';
|
||||
import type { Options } from '~/options';
|
||||
import type { DeepPartial } from '~/typings';
|
||||
import {
|
||||
addPlugin,
|
||||
ScrollbarsHidingPlugin,
|
||||
SizeObserverPlugin,
|
||||
ClickScrollPlugin,
|
||||
} from '~/plugins';
|
||||
import type { WH } from '~/support';
|
||||
import type { Options } from '~/options';
|
||||
import type { DeepPartial } from '~/typings';
|
||||
|
||||
addPlugin(ClickScrollPlugin);
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { playwrightRollup, expectSuccess } from '@~local/playwright-tooling';
|
||||
import type { Page } from '@playwright/test';
|
||||
import { test } from '@playwright/test';
|
||||
import type { Page } from '@playwright/test';
|
||||
|
||||
playwrightRollup();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user