XhmikosR / find-unused-sass-variables

A simple tool to find unused Sass variables

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Depending on the directory structure of 'node_modules', 'find' does not necessarily return results.

xootani opened this issue · comments

If the old version(example v7.0.13) of postcss installed in package, find() of find-unused-sass-variables is returned no result.
In this case, Declaration class referred to by find-unused-sass-variable and that referred to by postcss-scss are different.
Because, postcss-scss used old version(v7.0.13) of postcss and
find-unused-sass-variable used new version (v7.0.23 after) of postcss.
The node instance of Declaration always false in parse-variable.js.
The same applies to Comment class.

module path of Declaration class
postcss-scss /node_modules/postcss/lib/declaration.js
find-unused-sass-variables /node_modules/find-unused-sass-variables/node_modules/postcss/lib/declaration.js

examples: unused_test.zip

  1. npm install
  2. npm run test
    output console: { unused: [ '$unused1' ], total: 1 }
  3. npm install --save-dev postcss@7.0.13
  4. npm run test
    output console: { unused: [], total: 0 }

I'm not good at English.

node: v12.13.1
npm: v6.12.1

I'm not sure I understand your issue. There's no v7.2.0 of postcss.

I'm not sure I understand your issue. There's no v7.2.0 of postcss.

Thank you for your reply.
I fixed it because I had the wrong version number of postcss.

@XhmikosR
This problem has not been solved.
I rewritten the version number of postcss in the Issue text.
I am sorry for causing you a misunderstanding.
Would you please open an issue?

I need a repo to reproduce (not a zip file).

Also, v1.0.3 requires postcss v7.0.21, so you should not get old postcss installed if you do npm i.

Thank you for your reply.

I installed an old postcss package. It's a reproduce procedure, and usually this should be avoided.

However, users may install the find-unused-sass-variable in an environment where old postcss is already installed.

Besides installing postcss yourself, you may have already installed other package, that use postcss internally.

In this case, I think the problem is that it is difficult for users to recognize that old postcss is installed.

The problem is that postcss is installed in multiple locations.

For this reason, I understand that updating postcss and running npm dedupe will solve the problem.

If find() doesn't work, you should state that users need to update the postcss used by other packages.

A properly working package manager won't result in what you describe.

The situation you describe is non-standard. There's nothing for me to state if one has a broken system.

As you say, 'npm' has this issue.