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

Commit

Permalink
Observe disableWhenNoEslintConfig config
Browse files Browse the repository at this point in the history
  • Loading branch information
IanVS committed Jan 8, 2017
1 parent 668496c commit a7e073d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
7 changes: 6 additions & 1 deletion lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, a
const scopes = [];
let showRule;
let ignoredRulesWhenModified;
let disableWhenNoEslintConfig;

module.exports = {
activate() {
Expand Down Expand Up @@ -57,7 +58,7 @@ module.exports = {
// Do not try to fix if linting should be disabled
const fileDir = _path2.default.dirname(filePath);
const configPath = (0, _workerHelpers.getConfigPath)(fileDir);
if (configPath === null && atom.config.get('linter-eslint.disableWhenNoEslintConfig')) return;
if (configPath === null && disableWhenNoEslintConfig) return;

this.worker.request('job', {
type: 'fix',
Expand Down Expand Up @@ -112,6 +113,10 @@ module.exports = {
showRule = value;
}));

this.subscriptions.add(atom.config.observe('linter-eslint.disableWhenNoEslintConfig', value => {
disableWhenNoEslintConfig = value;
}));

this.subscriptions.add(atom.config.observe('linter-eslint.rulesToSilenceWhileTyping', ids => {
ignoredRulesWhenModified = (0, _helpers.idsToIgnoredRules)(ids);
}));
Expand Down
9 changes: 8 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { getConfigPath } from './worker-helpers'
const scopes = []
let showRule
let ignoredRulesWhenModified
let disableWhenNoEslintConfig

module.exports = {
activate() {
Expand Down Expand Up @@ -53,7 +54,7 @@ module.exports = {
// Do not try to fix if linting should be disabled
const fileDir = Path.dirname(filePath)
const configPath = getConfigPath(fileDir)
if (configPath === null && atom.config.get('linter-eslint.disableWhenNoEslintConfig')) return
if (configPath === null && disableWhenNoEslintConfig) return

this.worker.request('job', {
type: 'fix',
Expand Down Expand Up @@ -106,6 +107,12 @@ module.exports = {
})
)

this.subscriptions.add(
atom.config.observe('linter-eslint.disableWhenNoEslintConfig', (value) => {
disableWhenNoEslintConfig = value
})
)

this.subscriptions.add(atom.config.observe('linter-eslint.rulesToSilenceWhileTyping', (ids) => {
ignoredRulesWhenModified = idsToIgnoredRules(ids)
}))
Expand Down

0 comments on commit a7e073d

Please sign in to comment.