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 #130 from AtomLinter/fix-subscriptions
Browse files Browse the repository at this point in the history
Track and dispose of subscriptions
  • Loading branch information
Arcanemagus committed Mar 14, 2016
2 parents 59d7a27 + 7703fe2 commit f2c5c5d
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions lib/index.js
Expand Up @@ -5,6 +5,7 @@ import * as stylelint from 'stylelint';
import { rangeFromLineNumber } from 'atom-linter';
import assign from 'deep-assign';
import cosmiconfig from 'cosmiconfig';
import { CompositeDisposable } from 'atom';

export const config = {
useStandard: {
Expand All @@ -24,6 +25,7 @@ export const config = {
let useStandard;
let presetConfig;
let disableWhenNoConfig;
let subscriptions;

function createRange(editor, data) {
// data.line & data.column might be undefined for non-fatal invalid rules,
Expand All @@ -36,12 +38,18 @@ function createRange(editor, data) {
export function activate() {
require('atom-package-deps').install('linter-stylelint');

atom.config.observe('linter-stylelint.useStandard', value => {
subscriptions = new CompositeDisposable();

subscriptions.add(atom.config.observe('linter-stylelint.useStandard', value => {
useStandard = value;
});
atom.config.observe('linter-stylelint.disableWhenNoConfig', value => {
}));
subscriptions.add(atom.config.observe('linter-stylelint.disableWhenNoConfig', value => {
disableWhenNoConfig = value;
});
}));
}

export function deactivate() {
subscriptions.dispose();
}

function runStylelint(editor, options, filePath) {
Expand Down

0 comments on commit f2c5c5d

Please sign in to comment.