Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@ node_modules
.vscode-test/
.DS_Store
dist/
test/fixtures/temp.js
test/fixtures/temp2.js
test/fixtures/temp
coverage/
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"lint": "eslint . --ignore-pattern test/fixtures/",
"pretest": "yarn lint",
"test": "node ./test/runTest.js",
"test:update": "SNAPSHOT_UPDATE=true COVERAGE=true node ./test/runTest.js",
"test:update": "SNAPSHOT_UPDATE=true node ./test/runTest.js",
"dev": "NODE_ENV=dev node ./scripts/build.js",
"watch": "NODE_ENV=dev,watch node ./scripts/build.js",
"build": "NODE_ENV=prod node ./scripts/build.js",
Expand Down
4 changes: 2 additions & 2 deletions src/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ let outputChannel;

async function formatter(document, range) {
const documentPath = path.dirname(document.fileName);
const workspaceDir = workspace?.workspaceFolders.find((w) => w.uri.path === documentPath)?.uri
.path;
const workspaceDir = workspace?.workspaceFolders.find((w) => documentPath.startsWith(w.uri.path))
?.uri.path;
try {
if (
isFilePathMatchedByEslintIgnore(document.fileName, workspaceDir)
Expand Down
Empty file added test/fixtures/temp/.gitkeep
Empty file.
7 changes: 7 additions & 0 deletions test/fixtures/temp/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const options = {
first: "hello, world",
second: true,
internationalizing: true,
}

export { options }
2 changes: 1 addition & 1 deletion test/suite/extension.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('Extension Test Suite', () => {

test('Formats document using .eslintrc', async () => {
const content = fs.readFileSync(sourceFile).toString().replace('/* eslint-disable */\n', '');
const filePath = `${basePath}/temp.js`;
const filePath = `${basePath}/temp/test.js`;
fs.writeFileSync(filePath, content, { overwrite: true });
const document = await helper.openFile(filePath);
await vscode.commands.executeCommand('editor.action.formatDocument');
Expand Down