-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Closed
Labels
acceptedThere is consensus among the team that this change meets the criteria for inclusionThere is consensus among the team that this change meets the criteria for inclusionarchived due to ageThis issue has been archived; please open a new issue for any further discussionThis issue has been archived; please open a new issue for any further discussioncoreRelates to ESLint's core APIs and featuresRelates to ESLint's core APIs and featuresenhancementThis change enhances an existing feature of ESLintThis change enhances an existing feature of ESLint
Milestone
Description
Currently the CLI engine looks explicitly for filenames that end in a .js
see:
Line 170 in 5e601fb
if (path.extname(filename) === ".js") { |
It would be a nice feature for files which use shebangs to infer the interpreter from #!/usr/bin/env node
or similar when no extension is found.
else if (path.extname(filename) === "") {
// one of the three methods below
}
I have thought about a couple of ways to make this work:
- Read the first n bytes to see if contains
#!
andnode
- Use libmagic or
file(1)
to determine file type - Allow the user to explicitly state the files which are to be linted as config.
By allowing this we can allow users who write JS on the server side using d8
or spidermonkey to explicitly define the interpreter that will be used at execution.
Metadata
Metadata
Assignees
Labels
acceptedThere is consensus among the team that this change meets the criteria for inclusionThere is consensus among the team that this change meets the criteria for inclusionarchived due to ageThis issue has been archived; please open a new issue for any further discussionThis issue has been archived; please open a new issue for any further discussioncoreRelates to ESLint's core APIs and featuresRelates to ESLint's core APIs and featuresenhancementThis change enhances an existing feature of ESLintThis change enhances an existing feature of ESLint