- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 2.3k
Open
standard/standard-engine
#329Description
Here's what I did
Files
- 
package.json{ "name": "testcase", "version": "1.0.0", "type": "module", "dependencies": { "standard": "17.1.0" } }
- 
index.jsimport fs from "node:fs/promises"; import process from "node:process"; import standard from "standard"; console.log(await fs.readFile("foo/bar.js", "utf8")); console.log(await standard.lintFiles(["foo/bar.js"])); process.chdir("foo"); console.log(await fs.readFile("bar.js", "utf8")); console.log(await standard.lintFiles(["bar.js"])); 
- 
foo/bar.jsvar baz = 'qux' 
Steps
- npm install
- node index.js
What I expected to happen
var baz = 'qux'
[
  {
    filePath: '/home/regseb/testcase/foo/bar.js',
    messages: [ [Object], [Object] ],
    suppressedMessages: [],
    errorCount: 1,
    fatalErrorCount: 0,
    warningCount: 1,
    fixableErrorCount: 0,
    fixableWarningCount: 1,
    source: "var baz = 'qux'\n",
    usedDeprecatedRules: [Getter]
  }
]
var baz = 'qux'
[
  {
    filePath: '/home/regseb/testcase/foo/bar.js',
    messages: [ [Object], [Object] ],
    suppressedMessages: [],
    errorCount: 1,
    fatalErrorCount: 0,
    warningCount: 1,
    fixableErrorCount: 0,
    fixableWarningCount: 1,
    source: "var baz = 'qux'\n",
    usedDeprecatedRules: [Getter]
  }
]
What seems to have happened
var baz = 'qux'
[
  {
    filePath: '/home/regseb/testcase/foo/bar.js',
    messages: [ [Object], [Object] ],
    suppressedMessages: [],
    errorCount: 1,
    fatalErrorCount: 0,
    warningCount: 1,
    fixableErrorCount: 0,
    fixableWarningCount: 1,
    source: "var baz = 'qux'\n",
    usedDeprecatedRules: [Getter]
  }
]
var baz = 'qux'
/home/regseb/testcase/node_modules/eslint/lib/cli-engine/file-enumerator.js:320
                    throw new NoFilesFoundError(
                          ^
NoFilesFoundError: No files matching 'bar.js' were found.
    at FileEnumerator.iterateFiles (/home/regseb/testcase/node_modules/eslint/lib/cli-engine/file-enumerator.js:320:27)
    at iterateFiles.next (<anonymous>)
    at CLIEngine.executeOnFiles (/home/regseb/testcase/node_modules/eslint/lib/cli-engine/cli-engine.js:797:48)
    at ESLint.lintFiles (/home/regseb/testcase/node_modules/eslint/lib/eslint/eslint.js:551:23)
    at StandardEngine.lintFiles (/home/regseb/testcase/node_modules/standard-engine/index.js:89:41)
    at file:///home/regseb/testcase/index.js:11:28 {
  messageTemplate: 'file-not-found',
  messageData: { pattern: 'bar.js', globDisabled: false }
}
Node.js v20.10.0
Standard doesn't use the current directory. It uses the current directory when importing "standard":
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
No status