Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve package name properly #220

Merged
merged 1 commit into from Sep 30, 2022

Conversation

alexeisersun
Copy link
Contributor

@alexeisersun alexeisersun commented Sep 30, 2022

Problem statement

Currently, in our project we have 2 codebases that use CoffeeScript. Oddly enough, the oldest part uses CoffeeScript 1, while the newest - CoffeeScript 2. Both of these codebases were linted using coffeelint.

A problem has arisen when we tried to use Webpack's import() syntax, which worked for CoffeeScript, but not for the our old coffeelint.

To solve this, we tried to update the library and use @coffeelint/cli.
That's when we discovered that, although this package (@coffeelint/cli) and coffeelint can co-exist (each with its own dependencies), the node_modules/@coffeelint/cli/bin/coffeelint binary still resolves to the old coffeelint package, and not to the @coffeelint/cli. With this setup, the linter uses old coffee-script package (a dependency of coffeelint).

Steps to reproduce

  1. create a test file
# inside sample.coffee
import("./some_package")
  1. add 2 packages - old and new coffeelint
yarn add -D coffeelint # install old coffeelint
yarn add -D @coffeelint/cli # install new coffeelint
  1. run checks using old coffeelint
node_modules/coffeelint/bin/coffeelint sample.coffee 
 ✗ sample.coffee
     ✗ #1: [stdin]:1:7: error: unexpected (
import("./other")
      ^.

✗ Lint! » 1 error and 0 warnings in 1 file
  1. run checks using new coffeelint
node_modules/@coffeelint/cli/bin/coffeelint sample.coffee 
 ✗ sample.coffee
     ✗ #1: [stdin]:1:7: error: unexpected (
import("./other")
      ^.

✗ Lint! » 1 error and 0 warnings in 1 file
  1. remove old coffelint
yarn remove coffeelint
  1. run new coffeelint
node_modules/@coffeelint/cli/bin/coffeelint sample.coffee
  ✓ sample.coffee

✓ Ok! » 0 errors and 0 warnings in 1 file

Solution

Changed the resolved package name in bin/coffeelint, to resolve to @coffeelint/cli.

Copy link
Member

@UziTech UziTech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the detailed explanation and the fix. 💯

@UziTech UziTech merged commit 6e02503 into coffeelint:master Sep 30, 2022
github-actions bot pushed a commit that referenced this pull request Sep 30, 2022
## [5.2.10](v5.2.9...v5.2.10) (2022-09-30)

### Bug Fixes

* resolve to correct coffeelint file ([#220](#220)) ([6e02503](6e02503))
@github-actions
Copy link
Contributor

🎉 This PR is included in version 5.2.10 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants