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

Airbnb is overriding my local config on 'Fix on Save' #197

Closed
HauptmannEck opened this issue Feb 25, 2016 · 15 comments · Fixed by #201
Closed

Airbnb is overriding my local config on 'Fix on Save' #197

HauptmannEck opened this issue Feb 25, 2016 · 15 comments · Fixed by #201
Labels

Comments

@HauptmannEck
Copy link

Version

3.4.7

Issue

Using the rule:
disallowTrailingComma
When 'Fix on Save' and 'Only Config' is selected with a preset of 'airbnb', instead on removing the trailing commas, it adds them. Then errors that there are trailing spaces.

If I switch to 'google' as a preset then they problem goes away.

@HauptmannEck
Copy link
Author

Is there supposed to be a 'none' option? I cannot see it, even after restarting Atom.

@dwelle
Copy link

dwelle commented Feb 25, 2016

regression from f13fc77

/cc @casesandberg

@Arcanemagus
Copy link
Member

Fix published in v3.4.8, can you verify @HauptmannEck?

@HauptmannEck
Copy link
Author

Verified the fix, all is well.

@Arcanemagus
Copy link
Member

Glad to hear it 😉.

@dwelle
Copy link

dwelle commented Feb 27, 2016

Not fixed for me, but I'm having some issues with atom cache so I'm not 100% positive. But reading the code, it's not fixed yet. It still checks for <none> preset which is now missing from the list.

/cc @Arcanemagus @HauptmannEck

@Arcanemagus
Copy link
Member

@casesandberg Looks like v3.4.7 didn't fully take into account the places presets are looked at, mind taking a look?

@zoltanradics
Copy link

When linter-jscs is enabled and my .jscsrc file is located in my project folder, linter-jscs is changing between the (probably) airbnb and my preset on each save. Which means i save my file once and it fixes with my preset and if i save again, it fixes with (probably) Airbnb preset. My package config is: Config file path: (empty), Esnext: false, Fix on save: true, Only config: true.

@epsitec
Copy link

epsitec commented Mar 14, 2016

Here is my configuration, manually edited to have preset set to <none>:

  "linter-jscs":
    esnext: true
    fixOnSave: true
    harmony: true
    preset: "<none>"
    verbose: true

However, in Atom (with v3.4.8), I see this:

airbnb-default

and the fix on save feature still breaks my layout.

@epsitec
Copy link

epsitec commented Mar 14, 2016

Please add the <none> option back in at line 19:

  static config = {
    preset: {
      title: 'Preset',
      description: 'Preset option is ignored if a config file is found for the linter.',
      type: 'string',
      default: 'airbnb',
      enum: ['<none>', 'airbnb', 'crockford', 'google', 'grunt', 'idiomatic', 'jquery', 'mdcs', 'node-style-guide', 'wikimedia', 'wordpress', 'yandex'],
    },

By the way, I am using this .jscsrc to ensure that I get spaces between method names and parentheses:

{
  "requireBlocksOnNewline":                   true,
  "requireCamelCaseOrUpperCaseIdentifiers":   true,
  "requireCapitalizedConstructors":           true,
  "requireCommaBeforeLineBreak":              true,
  "requireCurlyBraces":                       ["if", "else", "for", "try", "catch"],
  "requireDotNotation":                       true,
  "requireLineFeedAtFileEnd":                 true,
  "requireOperatorBeforeLineBreak":           true,
  "requireParenthesesAroundIIFE":             true,

  "requireSpaceBetweenArguments":             true,
  "requireSpacesInCallExpression":            true,
  "requireSpacesInForStatement":              true,

  "requireSpaceAfterBinaryOperators":         true,
  "requireSpaceAfterKeywords":                true,
  "requireSpaceAfterLineComment":             true,

  "requireSpaceBeforeBinaryOperators":        true,
  "requireSpaceBeforeBlockStatements":        true,
  "requireSpaceBeforeObjectValues":           true,

  "requireSpacesInConditionalExpression":     true,
  "requireSpacesInFunction": {
    "beforeOpeningRoundBrace":                true,
    "beforeOpeningCurlyBrace":                true
  },

  "disallowEmptyBlocks":                      true,
  "disallowKeywordsOnNewLine":                ["else", "catch"],
  "disallowNewlineBeforeBlockStatements":     true,
  "disallowPaddingNewlinesInBlocks":          false,
  "disallowQuotedKeysInObjects":              true,
  "disallowMixedSpacesAndTabs":               true,
  "disallowTrailingWhitespace":               true,

  "disallowSpaceAfterPrefixUnaryOperators":   true,
  "disallowSpaceBeforePostfixUnaryOperators": true,
  "disallowSpaceAfterObjectKeys":             { "allExcept": ["method"] },

  "disallowSpacesInsideArrayBrackets":        { "allExcept": [ "}", "]" ]},
  "disallowSpacesInsideObjectBrackets":       { "allExcept": [ "}", "]" ]},

  "disallowYodaConditions":                   true,

  "safeContextKeyword":                       ["self"],

  "jsDoc": {
    "checkParamNames":                        true,
    "checkRedundantParams":                   true,
    "requireParamTypes":                      true
  },

  "validateIndentation":                      2,
  "validateParameterSeparator":               ", ",
  "validateQuoteMarks":                       "'",

  "maximumLineLength": {
    "value":                                  120,
    "allowUrlComments":                       true,
    "allowRegex":                             true
  },

  "esnext":                                   true,
  "requireSemicolons":                        true
}

@Arcanemagus
Copy link
Member

@epsitec There should be no need of that setting, the fact that Fix on Save wasn't properly updated to not need it doesn't mean it should be added back...

As it looks like @casesandberg hasn't had time to look into this I'll see if I can as it seems nobody has put up a PR fixing this.

@epsitec
Copy link

epsitec commented Mar 14, 2016

@Arcanemagus that would be nice. I have no idea how you would debug the plugin in atom while it is running, so I'll happily let somebody else who is more comfortable with the idea propose a PR.

Arcanemagus added a commit that referenced this issue Mar 14, 2016
fixOnSave could potentially use the preset if one wasn't defined in the supplied configuration.

Fixes #197.
Arcanemagus added a commit that referenced this issue Mar 14, 2016
fixOnSave could potentially use the preset if one wasn't defined in the supplied configuration.

Fixes #197.
@Arcanemagus Arcanemagus mentioned this issue Mar 14, 2016
@Arcanemagus
Copy link
Member

Okay, real fix is published in v3.4.9. Please verify that it's working properly for you.

@zoltanradics
Copy link

Now It's seems to be working for me. Thanks!

@epsitec
Copy link

epsitec commented Mar 15, 2016

OK for me too.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants