Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Commit

Permalink
Merge pull request #553 from AtomLinter/arcanemagus/fix-local-styleli…
Browse files Browse the repository at this point in the history
…nt-config

Use local stylelint for config resolution if available
  • Loading branch information
Arcanemagus authored Feb 4, 2020
2 parents b598700 + 21c1d7f commit 6686c77
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 4 additions & 0 deletions lib/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ export function refreshModulesPath(modulesDir) {
}

function getProjectDir(filePath) {
if (!filePath) {
// No file (e.g. in the specs)
return null;
}
const projectDir = atom.project.relativizePath(filePath)[0];
return projectDir !== null ? projectDir : path.dirname(filePath);
}
Expand Down
6 changes: 2 additions & 4 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import hasValidScope from './validate';
// Dependencies
let helpers;
let dirname;
let stylelint;

function loadDeps() {
if (!helpers) {
Expand All @@ -16,9 +15,6 @@ function loadDeps() {
if (!dirname) {
({ dirname } = require('path'));
}
if (!stylelint) {
stylelint = require('stylelint');
}
}

export default {
Expand Down Expand Up @@ -156,6 +152,8 @@ export default {
}

helpers.startMeasure('linter-stylelint: Create Linter');
// Use the project local stylelint to resolve the config if one exists
const stylelint = await helpers.getStylelintInstance();
const stylelintLinter = await stylelint.createLinter();
helpers.endMeasure('linter-stylelint: Create Linter');

Expand Down

0 comments on commit 6686c77

Please sign in to comment.