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

Support Yarn Plug'n'Play #186

Closed
Kurt-von-Laven opened this issue Jun 1, 2021 · 7 comments · Fixed by #208
Closed

Support Yarn Plug'n'Play #186

Kurt-von-Laven opened this issue Jun 1, 2021 · 7 comments · Fixed by #208

Comments

@Kurt-von-Laven
Copy link

Kurt-von-Laven commented Jun 1, 2021

The GitHub Action works great so long as you are installing any additional dictionaries that may be needed to node_modules. If you are using Yarn Plug'n'Play, then the GitHub Action will succeed, but you will see the following output if you inspect it.

Error: Configuration
        name: Error
        msg: Failed to read config file: "/home/runner/work/scribemd-server/scribemd-server/@cspell/dict-medicalterms/cspell-ext.json"
        stack:
Error: Failed to read config file: "/home/runner/work/scribemd-server/scribemd-server/@cspell/dict-medicalterms/cspell-ext.json"
    at x (/home/runner/work/_actions/streetsidesoftware/cspell-action/v1.1.2/action/main.js:2:322011)
    at T (/home/runner/work/_actions/streetsidesoftware/cspell-action/v1.1.2/action/main.js:2:323503)
    at /home/runner/work/_actions/streetsidesoftware/cspell-action/v1.1.2/action/main.js:2:322912
    at f.map (<anonymous>)
    at S (/home/runner/work/_actions/streetsidesoftware/cspell-action/v1.1.2/action/main.js:2:322904)
    at C (/home/runner/work/_actions/streetsidesoftware/cspell-action/v1.1.2/action/main.js:2:324241)
    at async Object.t.readConfig (/home/runner/work/_actions/streetsidesoftware/cspell-action/v1.1.2/action/main.js:2:425991)
    at async /home/runner/work/_actions/streetsidesoftware/cspell-action/v1.1.2/action/main.js:2:428389
    at async Object.t.lint (/home/runner/work/_actions/streetsidesoftware/cspell-action/v1.1.2/action/main.js:2:715873)
    at async /home/runner/work/_actions/streetsidesoftware/cspell-action/v1.1.2/action/main.js:2:711621
        
Files checked: 0, Issues found: 0 in 0 files.
Done.

This typically happens when a library sources a dependency without using import or require.

@Jason3S
Copy link
Contributor

Jason3S commented Jun 2, 2021

This is already possible by using a .js configuration file.

cspell.config.js

'use strict';
require('./.pnp.js').setup();

/** @type { import("@cspell/cspell-types").CSpellUserSettings } */
const cspell = {
    description: 'Make cspell Yarn 2 PNP aware',
    import: [
        "@cspell/dict-medicalterms/cspell-ext.json"
    ]
};

module.exports = cspell;

cspell.json

{
    "import": [
        "./cspell.config.js"
    ]
}

Try it out with:

npx cspell trace AbioMed

@Jason3S
Copy link
Contributor

Jason3S commented Jun 2, 2021

Note: the cspell.config.js feature depends upon cspell 5.x.

The VS Code Spell checker is using cspell 4.x. To try out the next version of the extension see: Releases · streetsidesoftware/vscode-spell-checker

@Kurt-von-Laven
Copy link
Author

Kurt-von-Laven commented Jun 3, 2021

Gave this a shot, replacing .pnp.js with .pnp.cjs in our case, and I received the following error from the cspell GitHub Action. I checked, and this action depends on cspell ^5.3.1. We run yarn add @cspell/dict-medicalterms@v1.0.27 immediately before this action. Do you have any suggestions on debugging this further?

Configuration
        name: Error
        msg: Failed to read config file: "/home/runner/work/scribemd-server/scribemd-server/cspell.config.js"
        stack:
Error: Failed to read config file: "/home/runner/work/scribemd-server/scribemd-server/cspell.config.js"
    at x (/home/runner/work/_actions/streetsidesoftware/cspell-action/v1.1.2/action/main.js:2:322011)
    at T (/home/runner/work/_actions/streetsidesoftware/cspell-action/v1.1.2/action/main.js:2:323503)
    at /home/runner/work/_actions/streetsidesoftware/cspell-action/v1.1.2/action/main.js:2:322912
    at f.map (<anonymous>)
    at S (/home/runner/work/_actions/streetsidesoftware/cspell-action/v1.1.2/action/main.js:2:322904)
    at C (/home/runner/work/_actions/streetsidesoftware/cspell-action/v1.1.2/action/main.js:2:324241)
    at async Object.t.readConfig (/home/runner/work/_actions/streetsidesoftware/cspell-action/v1.1.2/action/main.js:2:425991)
    at async /home/runner/work/_actions/streetsidesoftware/cspell-action/v1.1.2/action/main.js:2:428389
    at async Object.t.lint (/home/runner/work/_actions/streetsidesoftware/cspell-action/v1.1.2/action/main.js:2:715873)
    at async /home/runner/work/_actions/streetsidesoftware/cspell-action/v1.1.2/action/main.js:2:711621

@Jason3S
Copy link
Contributor

Jason3S commented Jun 3, 2021

That should have worked. It is having trouble loading .js config files. I'll put a fix in soon.

@Kurt-von-Laven
Copy link
Author

Thank you!

@Jason3S
Copy link
Contributor

Jason3S commented Jun 6, 2021

@Kurt-von-Laven
With the release of 1.2.0, the above code should work.
With the next release, it will be possible to add a cspell.json option: "usePnP: true" instead of needing to require the .pnp file.

@Kurt-von-Laven
Copy link
Author

Also fixed in streetsidesoftware/cspell#1307.

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

Successfully merging a pull request may close this issue.

2 participants