Skip to content

Commit

Permalink
Discontinue lodash pick (#298)
Browse files Browse the repository at this point in the history
* refactor: remove reliance on lodash pick

* refactor: remove unused lodash.pick dependency
  • Loading branch information
carlosjeurissen authored Jan 25, 2024
1 parent fe291fc commit 836b2a7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
13 changes: 9 additions & 4 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import stylelint from 'stylelint';
// eslint-disable-next-line import/no-unresolved -- https://github.com/import-js/eslint-plugin-import/issues/2703
import doiuse from 'doiuse';
import pick from 'lodash.pick';
import { Result } from 'postcss';

/**
Expand Down Expand Up @@ -80,17 +79,23 @@ function ruleFunction(on, options) {
return;
}

const ignorePartialSupport = options ? options.ignorePartialSupport : false;
const doiuseOptions = pick(options, Object.keys(optionsSchema));
const usedFeatures = {};
const doiuseResult = new Result();
const doiuseOptions = {};

const usedFeatures = {};
if (options) {
Object.keys(optionsSchema).forEach((optionsKey) => {
doiuseOptions[optionsKey] = options[optionsKey];
});
}

doiuseOptions.onFeatureUsage = (info) => {
// Use the node as key to store feature information
usedFeatures[info.usage] = info.featureData;
};

const { ignorePartialSupport } = doiuseOptions;

doiuse(doiuseOptions).postcss(root, doiuseResult);
doiuseResult.warnings().forEach((doiuseWarning) => {
const featureData = usedFeatures[doiuseWarning.node];
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
},
"dependencies": {
"doiuse": "^6.0.2",
"lodash.pick": "^4.4.0",
"postcss": "^8.4.32"
},
"devDependencies": {
Expand Down

0 comments on commit 836b2a7

Please sign in to comment.