Skip to content

Commit

Permalink
fix: do not import lodash directly
Browse files Browse the repository at this point in the history
  • Loading branch information
targos committed May 13, 2021
1 parent cff87a4 commit ca47250
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .eslintrc.yml
Expand Up @@ -3,5 +3,9 @@ rules:
'import/default': off
'import/no-unresolved': off
'@typescript-eslint/no-explicit-any': off
no-restricted-imports:
- error
- name: lodash
message: "Use a deep import instead, like for example 'lodash/get'"
parserOptions:
sourceType: module
16 changes: 16 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Expand Up @@ -112,6 +112,7 @@
"react-router-dom": "^5.2.0",
"reactstrap": "^8.9.0",
"rimraf": "^3.0.2",
"rollup-plugin-analyzer": "^4.0.0",
"typescript": "~4.2.4",
"vite": "^2.3.2"
},
Expand Down
4 changes: 2 additions & 2 deletions src/component/panels/extra/preferences/ColumnsHelper.js
@@ -1,4 +1,4 @@
import lodash from 'lodash';
import lodashGet from 'lodash/get';

import FormatNumber from '../../../utility/FormatNumber';

Expand Down Expand Up @@ -86,5 +86,5 @@ export default class ColumnsHelper {
}

export function isColumnVisible(preferences, key) {
return lodash.get(preferences, key, false);
return lodashGet(preferences, key, false);
}
10 changes: 8 additions & 2 deletions vite.config.ts
@@ -1,9 +1,10 @@
import reactRefresh from '@vitejs/plugin-react-refresh';
import { defineConfig } from 'vite';
import analyze from 'rollup-plugin-analyzer';
import { AliasOptions, defineConfig } from 'vite';

// https://vitejs.dev/config/
export default ({ mode }) => {
let resolveAliases = {};
let resolveAliases: AliasOptions = [];
if (mode === 'profiling') {
resolveAliases = [
{ find: /react-dom$/, replacement: 'react-dom/profiling' },
Expand All @@ -20,6 +21,11 @@ export default ({ mode }) => {
import React from 'react';
`,
},
build: {
rollupOptions: {
plugins: process.env.ANALYZE ? [analyze()] : [],
},
},
plugins: [reactRefresh()],
resolve: {
alias: resolveAliases,
Expand Down

0 comments on commit ca47250

Please sign in to comment.