mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-12 20:18:41 -09:00
cleanup lodash usage
This commit is contained in:
parent
db2be9fe50
commit
562473a718
7 changed files with 25 additions and 15 deletions
|
|
@ -3,7 +3,8 @@
|
|||
"react",
|
||||
"prettier",
|
||||
"@typescript-eslint",
|
||||
"eslint-comments"
|
||||
"eslint-comments",
|
||||
"lodash"
|
||||
],
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
|
|
@ -93,12 +94,11 @@
|
|||
"@typescript-eslint/no-unsafe-assignment": "off",
|
||||
"@typescript-eslint/no-unsafe-member-access": "off",
|
||||
"@typescript-eslint/restrict-template-expressions": "off",
|
||||
"@typescript-eslint/consistent-type-imports": [
|
||||
"error",
|
||||
{
|
||||
"disallowTypeAnnotations": false
|
||||
}
|
||||
]
|
||||
"@typescript-eslint/consistent-type-imports": [ "error", { "disallowTypeAnnotations": false } ],
|
||||
"lodash/prop-shorthand": [ "error", "always" ],
|
||||
"lodash/import-scope": [ "error", "method" ],
|
||||
"lodash/collection-return": "error",
|
||||
"lodash/collection-method-value": "error"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import vm from 'vm';
|
|||
import notify from '../notify';
|
||||
import mapKeys from '../utils/map-keys';
|
||||
import type {parsedConfig, rawConfig, configOptions} from '../../lib/config';
|
||||
import _ from 'lodash';
|
||||
import merge from 'lodash/merge';
|
||||
|
||||
const _extract = (script?: vm.Script): Record<string, any> => {
|
||||
const module: Record<string, any> = {};
|
||||
|
|
@ -44,7 +44,7 @@ const _init = (userCfg: rawConfig, defaultCfg: rawConfig): parsedConfig => {
|
|||
if (!conf.profiles.map((p) => p.name).includes(conf.defaultProfile)) {
|
||||
conf.defaultProfile = conf.profiles[0].name;
|
||||
}
|
||||
return _.merge({}, defaultCfg.config, conf);
|
||||
return merge({}, defaultCfg.config, conf);
|
||||
} else {
|
||||
notify('Error reading configuration: `config` key is missing');
|
||||
return defaultCfg.config || ({} as configOptions);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import {builders, namedTypes} from 'ast-types';
|
|||
import * as babelParser from 'recast/parsers/babel';
|
||||
import {copy, copySync, existsSync, readFileSync, writeFileSync} from 'fs-extra';
|
||||
import {dirname, resolve} from 'path';
|
||||
import _ from 'lodash';
|
||||
import merge from 'lodash/merge';
|
||||
|
||||
import notify from '../notify';
|
||||
import {_extractDefault} from './init';
|
||||
|
|
@ -166,7 +166,7 @@ export const migrateHyper3Config = () => {
|
|||
try {
|
||||
const legacyCfgRaw = readFileSync(legacyCfgPath, 'utf8');
|
||||
const legacyCfgData = _extractDefault(legacyCfgRaw);
|
||||
newCfgData = _.merge({}, defaultCfgData, legacyCfgData);
|
||||
newCfgData = merge({}, defaultCfgData, legacyCfgData);
|
||||
|
||||
const pluginCode = configToPlugin(legacyCfgRaw);
|
||||
if (pluginCode) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import React from 'react';
|
||||
import _ from 'lodash';
|
||||
import sum from 'lodash/sum';
|
||||
import type {SplitPaneProps} from '../hyper';
|
||||
|
||||
export default class SplitPane extends React.PureComponent<SplitPaneProps, {dragging: boolean}> {
|
||||
|
|
@ -40,7 +40,7 @@ export default class SplitPane extends React.PureComponent<SplitPaneProps, {drag
|
|||
sizes_[this.paneIndex] = 0;
|
||||
sizes_[this.paneIndex + 1] = 0;
|
||||
|
||||
const availableWidth = 1 - _.sum(sizes_);
|
||||
const availableWidth = 1 - sum(sizes_);
|
||||
sizes_[this.paneIndex] = availableWidth / 2;
|
||||
sizes_[this.paneIndex + 1] = availableWidth / 2;
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@ import terms from '../terms';
|
|||
import processClipboard from '../utils/paste';
|
||||
import _SearchBox from './searchBox';
|
||||
import type {TermProps} from '../hyper';
|
||||
import {pickBy, isEqual} from 'lodash';
|
||||
import pickBy from 'lodash/pickBy';
|
||||
import isEqual from 'lodash/isEqual';
|
||||
import {decorate} from '../utils/plugins';
|
||||
import 'xterm/css/xterm.css';
|
||||
import {ImageAddon} from 'xterm-addon-image';
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
"css-loader": "6.8.1",
|
||||
"got": "12.4.1",
|
||||
"json-loader": "0.5.7",
|
||||
"lodash": "4.17.21",
|
||||
"mousetrap": "chabou/mousetrap#useCapture",
|
||||
"ms": "2.1.3",
|
||||
"open": "8.4.2",
|
||||
|
|
@ -117,6 +118,7 @@
|
|||
"eslint-plugin-eslint-comments": "^3.2.0",
|
||||
"eslint-plugin-json-schema-validator": "^4.5.0",
|
||||
"eslint-plugin-jsonc": "^2.9.0",
|
||||
"eslint-plugin-lodash": "^7.4.0",
|
||||
"eslint-plugin-prettier": "^5.0.0",
|
||||
"eslint-plugin-react": "7.32.2",
|
||||
"husky": "8.0.3",
|
||||
|
|
|
|||
|
|
@ -3225,6 +3225,13 @@ eslint-plugin-jsonc@^2.9.0:
|
|||
jsonc-eslint-parser "^2.0.4"
|
||||
natural-compare "^1.4.0"
|
||||
|
||||
eslint-plugin-lodash@^7.4.0:
|
||||
version "7.4.0"
|
||||
resolved "https://registry.npmjs.org/eslint-plugin-lodash/-/eslint-plugin-lodash-7.4.0.tgz#14a761547f126c92ff56789662a20a44f8bb6290"
|
||||
integrity sha512-Tl83UwVXqe1OVeBRKUeWcfg6/pCW1GTRObbdnbEJgYwjxp5Q92MEWQaH9+dmzbRt6kvYU1Mp893E79nJiCSM8A==
|
||||
dependencies:
|
||||
lodash "^4.17.21"
|
||||
|
||||
eslint-plugin-prettier@^5.0.0:
|
||||
version "5.0.0"
|
||||
resolved "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.0.0.tgz#6887780ed95f7708340ec79acfdf60c35b9be57a"
|
||||
|
|
@ -4959,7 +4966,7 @@ lodash.merge@^4.6.2:
|
|||
resolved "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a"
|
||||
integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==
|
||||
|
||||
lodash@^4.17.15, lodash@^4.17.21:
|
||||
lodash@4.17.21, lodash@^4.17.15, lodash@^4.17.21:
|
||||
version "4.17.21"
|
||||
resolved "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
|
||||
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
|
||||
|
|
|
|||
Loading…
Reference in a new issue