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

With 0.50, seeing errors from new eslint-plugin-n that can't be suppressed #670

Closed
AndrewMSHowe opened this issue Jun 20, 2022 · 4 comments · May be fixed by #672
Closed

With 0.50, seeing errors from new eslint-plugin-n that can't be suppressed #670

AndrewMSHowe opened this issue Jun 20, 2022 · 4 comments · May be fixed by #672

Comments

@AndrewMSHowe
Copy link

AndrewMSHowe commented Jun 20, 2022

xo 0.50 changed from eslint-plugin-node to eslint-plugin-n ('n'). I have some TypeScript code using optional chaining and nullish coalascing operators. eslint-plugin-n objects that as my node version is set to less than 14, I should not be using this syntax. However TypeScript transpiles these operators, as it knows what node version I am targeting. The 'n' documentation says "If you are using transpilers, maybe you want to ignore the warnings about some features. You can use this ignores option to ignore the given features."

I have in my .xo-config.json:
"n/no-unsupported-features/es-syntax": ["error", { "ignores": [ "optionalChaining", "nullishCoalescingOperators" ] }]

The errors are not suppressed. I was encouraged to submit an issue to 'n'. However it doesn't seem to be a problem with the 'n' plugin. I browsed the plugin code and it looks correct. Also I had previously left an 's' off the end of one of the 'ignores' strings and that should have reported an error, but I didn't see it.

I suspect that xo is not forwarding this config to the plugin correctly. Perhaps it is to do with your opinionated defaults that you want to apply? Sorry I don't really know how xo works internally. Anyway I have reverted to xo 0.49 for now.

@aladdin-add
Copy link
Contributor

I was able to repro. I've put a xo config in package.json to turn off the rule:

  "xo": {
    "rules": {
      "n/no-unsupported-features/es-syntax": 0
    }
  }

However, it does not work. I ran xo --print-config the output config is:

"n/no-unsupported-features/es-syntax": [
	"error",
	{
		"version": ">=12",
		"ignores": [
			"modules"
		]
	}
],

@AndrewMSHowe
Copy link
Author

BTW when I downgrade to xo 0.49, it complains "Definition for rule n/no-unsupported-features/es-syntax was not found."
Of course I still have the exclusion rule in my .xo-config.json until I remove it, but I am just saying that in this state it is putting something in the config.
In this case, my node/no-unsupported-features/es-syntax config entry looks like @aladdin-add 's above, but my n/ one is exactly what I had in my .xo-config.json (it is outputting both as of 0.49)
With 0.50, my n/ entry looks like @aladdin-add 's, and there is also a node/ one that's just ["off"].

@sindresorhus
Copy link
Member

Duplicate of #613

@sindresorhus sindresorhus marked this as a duplicate of #613 Jun 20, 2022
aladdin-add added a commit to aladdin-add/xo that referenced this issue Jun 21, 2022
atm, users cannot disable the rules, as the defaults was always applied.
fixes xojs#670
@fregante
Copy link
Member

fregante commented Aug 6, 2022

Closing as duplicate

@fregante fregante closed this as not planned Won't fix, can't repro, duplicate, stale Aug 6, 2022
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.

4 participants