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

Fix installing XO on npm 6 by bundling TS-dependent dependencies to avoid hoisting #624

Merged
merged 4 commits into from
Oct 27, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ const runEslint = async (lint, options) => {
return getIgnoredReport(filePath);
}

const eslint = new ESLint(eslintOptions);
const eslint = new ESLint({
...eslintOptions,
resolvePluginsRelativeTo: __dirname
Copy link
Member

Choose a reason for hiding this comment

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

Did you see #589 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, I have to give it a look, generally I think this shouldn't case any issue as it just ensures that plug-in resolution starts from within xo rather than one step up from xo, which helps when hoisting could otherwise have resolving happen that one step up.

As node module resolution traverses upwards all plugins on a higher level should still be found.

});

if (filePath && await eslint.isPathIgnored(filePath)) {
return getIgnoredReport(filePath);
Expand Down
2 changes: 1 addition & 1 deletion lib/options-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ const mergeWithPrettierConfig = (options, prettierOptions) => {

const buildTSConfig = options => config => {
if (options.ts) {
config.baseConfig.extends.push('xo-typescript');
config.baseConfig.extends.push(require.resolve('eslint-config-xo-typescript'));
config.baseConfig.parser = require.resolve('@typescript-eslint/parser');
config.baseConfig.parserOptions = {
...config.baseConfig.parserOptions,
Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@
"javascript",
"typescript"
],
"bundledDependencies": [
"@typescript-eslint/eslint-plugin",
"@typescript-eslint/parser",
"eslint-config-xo-typescript"
],
"dependencies": {
"@eslint/eslintrc": "^1.0.1",
"@typescript-eslint/eslint-plugin": "^4.32.0",
Expand Down