Skip to content

Bug: Issue with the rule n/file-extension-in-import on migrating from eslint-plugin-n@16.6.2 to eslint-plugin-n@17.10.2 #405

Open
@govind-srinidhi

Description

@govind-srinidhi

Environment

Node version: 20.12.2
npm version: 10.2.3
ESLint version: 9.16.0
eslint-plugin-n version: 17.10.2
Operating System: Mac

What rule do you want to report?

n/file-extension-in-import

Link to Minimal Reproducible Example

https://eslint-online-playground.netlify.app/#eNp9Uk1vnDAQ/SuWL+yuwJvtoVXJNZVyaqtKPZUcLJilpsZGtkkTIf57xh8QNhvlBJ558+bNm5moNfWxs4WzhegHbRxzlpa0UvFFJjIYodw9SKnJTM5G9yRjxxAs/vpodnsFFtdI4WGVOo+qdkKrCPzthLS7PZkqRTZ9dvvXt9jtsXCmeRC6kEWR8BS6XnL6ikhYa2W1BCZ1u8vuRbYQOYuZs2hZZ7VCmgCuaK37QUgwPwZPZitaRhqfU/pbL5wPOTOCj85Xorzyj3TFyd6TFlxc1IGViGarRORL7sbMTzm2Qn3XDUSLq1RRDCFRqIoGp5OIBs58lI788W3TPGcc05YYoofD8cAmZ/POzhV9yGNectWOvIXkxOoD7oQbuzq0iROymPpLa3cnTEnSNfXgOGuEUbyHRB+IjO6gdtHPNY6mhk8KxIm2fVR55cJliRnDaGsBru7oxy3gyYGyKLtAj6I2v070AIzRpqI5Yrn8z59x8zmZMlxlVpJMwSOYLMdL7jbvebEqKPbNH25xdwOv/6Fvbw7LPQ/ge1W01w3qQ/6YaODxDgZQDahawOXFxTFj2Vd2+sxuUtlrcrNxjzp9Yacb9mkD841tbcSQeCR3YPH/HUCx7bfg1jufXwBhKF5k

What did you expect to happen?

The rule n/file-extension-in-import is expected to throw lint errors when the extensions are not included in the imports. However when we configure the rule as below:

 "n/file-extension-in-import": ["error", "always", {'.ts': 'never', '.js': 'never'}],

For the above rule it's expected to not throw the lint errors when the imports do not have extensions for ts and js files. This used to work well in eslint-plugin-n@16.6.2, but looks like there's a bug in 17.x

Screenshot 2025-01-08 at 13 48 46

Participation

  • I am willing to submit a pull request for this issue.

Additional comments

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions