Code Monkey home page Code Monkey logo

Comments (36)

TomCarey avatar TomCarey commented on September 14, 2024 4

Expanding on what @adrianiskandar said:

Make a file called coffeelint.json in your project directory.

put the following in it to disable max line length errors/warnings

{
  "max_line_length": {
    "name": "max_line_length",
    "level": "ignore"
  }
}

from linter-coffeelint.

fungilation avatar fungilation commented on September 14, 2024

same here. These in config.cson doesn't change the error on length > 80 behaviour:

'linter-coffeelint':
'max_line_length': 500
'preferredLineLength': 500

I disabled coffeelint as this excessive error is annoying me too much.

from linter-coffeelint.

MarcPorciuncula avatar MarcPorciuncula commented on September 14, 2024

The actual linter config is called coffeelint.json and can be found in the package folder, it's easiest do do this by going to the package in settings and selecting 'open in atom'.

Problem solved, right? Nope. According to this file, the max line length has already been configured with a threshold of 120 characters and when exceeded its supposed to produce a warning, not an error.

"max_line_length": {
    "name": "max_line_length",
    "value": 120,
    "level": "warn",
    "limitComments": true
  }

But somehow this configuration isn't being applied correctly because I still get errors whenever i exceed 80 characters.

Upon inspecting my dev tools I found that I am getting an error that makes reference to the file, but the logs aren't very descriptive so I don't know exactly what's going wrong.

ss 2014-08-03 at 05 27 26
[although I think this may be caused by the hacking i had to do to linter because it doesn't play nice with windows]

But if it's not using the one in the package folder, it must fall back to something right? I tried adding the chunk of config above to linter-coffeelint/node_modules/coffeelint/coffeelint.json. But still no dice.

Upon even finer inspection I found generated_coffeelint.json inside the coffeelint node module, changed configs there and still nothing.

Damn it...

from linter-coffeelint.

adrianiskandar avatar adrianiskandar commented on September 14, 2024

I also tried several approaches so I read the coffeelint's documentation and it says this:

How do I configure CoffeeLint?

There are two main options. In the root of your project create a
coffeelint.json, or add a coffeelintConfig section to your package.json.
Either way, the configuration is exactly the same. If CoffeeLint doesn't find
any configuration for the current project, it will check for a
$HOME/coffeelint.json to use.

So you just need to create a coffeelint.json document in the root directory of your application and that's it!!! you can edit any rule in that file and it will apply the changes by just saving the file, you won't even need to restart atom. It is annoying that you can't edit this directly on config.cson but at least is a solution for the problem.

from linter-coffeelint.

markwainwright avatar markwainwright commented on September 14, 2024

+1
The errors are annoying and I'm really unclear how to set a longer line-length or remove the rule altogether!

from linter-coffeelint.

cperryk avatar cperryk commented on September 14, 2024

@TomCarey's suggestion works. Still, it would be great if you could set options like this globally.

from linter-coffeelint.

mathieucivel avatar mathieucivel commented on September 14, 2024

+1 It's annoying to have to add a coffeelint.json in each project.

from linter-coffeelint.

hd-deman avatar hd-deman commented on September 14, 2024

CoffeeLint will automatically pick up config files. When linting a file (as opposed to stdin) it will walk up the directory tree looking for a coffeelint.json or a package.json that has a "coffeelintConfig" object. If neither of those are found or you're linting from stdin it will check your home for a coffeelint.json file.
So, @cperryk, @mathieucivel try to put coffeelint.json in your home dir.

from linter-coffeelint.

jiku avatar jiku commented on September 14, 2024

Have to agree it's still annoying, but the home dir solution works.

from linter-coffeelint.

AsaAyers avatar AsaAyers commented on September 14, 2024

This should be fixed in v0.2.0. Please reopen if you're still having issues.

from linter-coffeelint.

ericop avatar ericop commented on September 14, 2024

This is still an issue for me today on Mac OS @AsaAyers

from linter-coffeelint.

AsaAyers avatar AsaAyers commented on September 14, 2024

When you run coffeelint from the commandline does it pick up your configuration? configuration docs

from linter-coffeelint.

ericop avatar ericop commented on September 14, 2024

Are you saying I can run coffeelint from the folder where Atom is setup? As in, I can have an Atom json file to configure this, or that it still only works via a projects specific rules? We have a Brunch config.coffee file with the following in it, so no package.json.

coffeelint:
  options:
    no_stand_alone_at: level: "error"
    space_operators: level: "error"
    no_interpolation_in_single_quotes: level: "error"
    no_unnecessary_fat_arrows: level: 'error'
    max_line_length: value: 110
    cyclomatic_complexity:
      value: 10
      level: "error"
    no_set_timeout:
      module: "./lint/noSetTimeout"
    no_set_interval:
      module: "./lint/noSetInterval"

from linter-coffeelint.

ericop avatar ericop commented on September 14, 2024

Just for those who come later, this 💥 max_line_length ❗ still occurs by default on any line over 80 characters. In my Mac OS #HOME folder I stuck in coffeelint.json with the following, and got what I was after:

    {
      "max_line_length": {
        "name": "max_line_length",
        "value": 110,
        "level": "warn",
        "limitComments": true
      }
    }

from linter-coffeelint.

bobrocke avatar bobrocke commented on September 14, 2024

Any chance of a fix, or has this package been abandoned?

from linter-coffeelint.

AsaAyers avatar AsaAyers commented on September 14, 2024

This package has not been abandoned. I don't see a problem here I can reproduce to fix.

CoffeeLint will resolve a configuration by looking in the same folder for coffeelint.json, then repeat. If it gets to the root of your drive and still hasn't found a config to use it will use $HOME/coffeelint.json. If you can open a terminal and run coffeelint path/to/your/file.coffee and it picks up the config but linter-coffeelint doesn't, then there's a bug that I will fix ASAP.

from linter-coffeelint.

AsaAyers avatar AsaAyers commented on September 14, 2024

same folder = same folder as the file you are linting. If your project lives in

/projects/my-project and your linting src/something.coffee it will check:

/projects/my-project/src/coffeelint.json
/projects/my-project/coffeelint.json
/projects/coffeelint.json
/coffeelint.json
$HOME/coffeelint.json (or whatever is appropriate for your OS)

from linter-coffeelint.

bobrocke avatar bobrocke commented on September 14, 2024

So, is /coffeelint.json explicitly not .atom/packages/linter-coffeelint/coffeelint.json?

from linter-coffeelint.

AsaAyers avatar AsaAyers commented on September 14, 2024

yes, the coffeelint.json that is committed in linter-coffeelint is simply the rules for this project. If it doesn't find any configuration file it just lets CoffeeLint use the default values, which includes setting max_line_length to 80 and error

The linter-coffeelint/coffeelint.json (and this issue) predate my joining this project. I didn't realize people would think that is the default. I'll clean up (or maybe remove) the file from this repo

from linter-coffeelint.

bobrocke avatar bobrocke commented on September 14, 2024

Maybe allow that file to be edited and be the last one checked? That way any other coffeelint.json files will override it, but the default can still be changed.

from linter-coffeelint.

AsaAyers avatar AsaAyers commented on September 14, 2024

If you want a global default create a $HOME/coffeelint.json. The whole
point of this strategy is that you configure your project not your editor.
That way the next person to work in your code base using a different editor
doesn't have to waste time trying to figure out how to make his editors
config match yours.
On May 17, 2015 1:28 PM, "Bob Rockefeller" [email protected] wrote:

Maybe allow that file to be edited and be the last one checked? That way
any other coffeelint.json files will override it, but the default can
still be changed.


Reply to this email directly or view it on GitHub
#10 (comment)
.

from linter-coffeelint.

bobrocke avatar bobrocke commented on September 14, 2024

I understand. But there are many Atom packages that have local settings - many, including myself, would look to that, first.

On Mac OS X, by $HOME, do you mean /Users/bob, for me?

from linter-coffeelint.

AsaAyers avatar AsaAyers commented on September 14, 2024

envs = process.env.USERPROFILE or process.env.HOME or process.env.HOMEPATH
yes

From what I can tell going and editing the plugin code directly is always the wrong strategy. If the package were configurable it would have a settings button.

selection_002

Instead the README.md addresses settings:

Settings

As of v0.2.0 there is no need to specify a path to coffeelint. If you need to use a specific version you can specify it in your project's package.json and linter-coffeelint will use that one. This is the same behavior the coffeelint commandline gives you.

Your configuration belongs in your project, not your editor.
https://github.com/clutchski/coffeelint/blob/master/doc/user.md

In an attempt to remove any future confusion I have removed the coffeelint.json from this project as the defaults are fine.

from linter-coffeelint.

ericop avatar ericop commented on September 14, 2024

Still, I think the bottom line is that the line length error is defaults to
too short a value, correct?
On May 17, 2015 2:04 PM, "Asa Ayers" [email protected] wrote:

envs = process.env.USERPROFILE or process.env.HOME or process.env.HOMEPATH
yes
https://github.com/clutchski/coffeelint/blob/master/src/configfinder.coffee#L52

From what I can tell going and editing the plugin code directly is always
the wrong strategy. If the package were configurable it would have a
settings button.

[image: selection_002]
https://cloud.githubusercontent.com/assets/324999/7671415/6a075aa4-fc9d-11e4-829e-7abff077f0d1.png

Instead the README.md addresses settings:

Settings

As of v0.2.0 there is no need to specify a path to coffeelint. If you need
to use a specific version you can specify it in your project's
package.json and linter-coffeelint will use that one. This is the same
behavior the coffeelint commandline gives you.

Your configuration belongs in your project, not your editor.
https://github.com/clutchski/coffeelint/blob/master/doc/user.md

In an attempt to remove any future confusion I have removed the
coffeelint.json from this project as the defaults are fine.


Reply to this email directly or view it on GitHub
#10 (comment)
.

from linter-coffeelint.

AsaAyers avatar AsaAyers commented on September 14, 2024

Your opinion is that the default is too short. That's why it's a default and you can configure it.

It's not too short for PEP-8

Limiting the required editor window width makes it possible to have several files open side-by-side, and works well when using code review tools that present the two versions in adjacent columns.

or Atom's default column guide:

selection_003

Or my screen when I need a terminal (usually running tests on every save) and an editor (with the tree view removed)

workspace 3_004

from linter-coffeelint.

yorkxin avatar yorkxin commented on September 14, 2024

I added a coffeelint.json in my project's root dir and it works

{
  "max_line_length": {
    "value": 9999
  },
  "coffeelint": {
    "transforms": [ "coffee-react-transform" ]
  }
}

from linter-coffeelint.

AsaAyers avatar AsaAyers commented on September 14, 2024

use ignore to turn off a rule.

{
  "max_line_length": {
    "level": "ignore"
  },
  "coffeelint": {
    "transforms": [ "coffee-react-transform" ]
  }
}

from linter-coffeelint.

yorkxin avatar yorkxin commented on September 14, 2024

@AsaAyers thank you, didn't notice this option :p

from linter-coffeelint.

archcorsair avatar archcorsair commented on September 14, 2024

@AsaAyers coffeelint crashes as soon as I open Atom with coffeelint.json in my project root. I tried both "level": "ignore" and "value": 9999

from linter-coffeelint.

AsaAyers avatar AsaAyers commented on September 14, 2024

please define "crashes"

from linter-coffeelint.

archcorsair avatar archcorsair commented on September 14, 2024

@AsaAyers coffeelint shows a generic error CoffeeLint crashed, see console for error details..

Here's what I have in my console:

C:\Users\archc_000\.atom\packages\linter-coffeelint\lib\core.coffee:79 Cannot find module 'coffee-react-transform' from 'D:\Desktop\etsy2015\app\assets'
C:\Users\archc_000\.atom\packages\linter-coffeelint\lib\core.coffee:80 Error: Cannot find module 'coffee-react-transform' from 'D:\Desktop\etsy2015\app\assets'
  at module.exports (C:\Users\archc_000\.atom\packages\linter-coffeelint\node_modules\coffeelint\node_modules\resolve\lib\sync.js:32:11)
  at C:\Users\archc_000\.atom\packages\linter-coffeelint\node_modules\coffeelint\lib\configfinder.js:89:16
  at Array.map (native)
  at expandModuleNames (C:\Users\archc_000\.atom\packages\linter-coffeelint\node_modules\coffeelint\lib\configfinder.js:88:53)
  at Object.exports.getConfig (C:\Users\archc_000\.atom\packages\linter-coffeelint\node_modules\coffeelint\lib\configfinder.js:115:16)
  at Object.module.exports.lint (C:\Users\archc_000\.atom\packages\linter-coffeelint\lib\core.coffee:68:29)
  at _Class.module.exports._Class.lint (C:\Users\archc_000\.atom\packages\linter-coffeelint\lib\plus-linter.coffee:44:19)
  at _Class.lint (C:\Users\archc_000\.atom\packages\linter-coffeelint\lib\plus-linter.coffee:1:1)
  at C:\Users\archc_000\.atom\packages\linter\lib\editor-linter.coffee:69:26
  at currentLinter (C:\Users\archc_000\.atom\packages\linter\lib\editor-linter.coffee:68:20)
  at C:\Users\archc_000\.atom\packages\linter\lib\editor-linter.coffee:82:23
  at Set.forEach (native)
  at EditorLinter.triggerLinters (C:\Users\archc_000\.atom\packages\linter\lib\editor-linter.coffee:64:26)
  at C:\Users\archc_000\.atom\packages\linter\lib\editor-linter.coffee:57:27

C:\Users\archc_000\.atom\packages\linter-coffeelint\lib\core.coffee:79 Cannot find module 'coffee-react-transform' from 'D:\Desktop\etsy2015\app\assets'
C:\Users\archc_000\.atom\packages\linter-coffeelint\lib\core.coffee:80 Error: Cannot find module 'coffee-react-transform' from 'D:\Desktop\etsy2015\app\assets'
  at module.exports (C:\Users\archc_000\.atom\packages\linter-coffeelint\node_modules\coffeelint\node_modules\resolve\lib\sync.js:32:11)
  at C:\Users\archc_000\.atom\packages\linter-coffeelint\node_modules\coffeelint\lib\configfinder.js:89:16
  at Array.map (native)
  at expandModuleNames (C:\Users\archc_000\.atom\packages\linter-coffeelint\node_modules\coffeelint\lib\configfinder.js:88:53)
  at Object.exports.getConfig (C:\Users\archc_000\.atom\packages\linter-coffeelint\node_modules\coffeelint\lib\configfinder.js:115:16)
  at Object.module.exports.lint (C:\Users\archc_000\.atom\packages\linter-coffeelint\lib\core.coffee:68:29)
  at _Class.module.exports._Class.lint (C:\Users\archc_000\.atom\packages\linter-coffeelint\lib\plus-linter.coffee:44:19)
  at _Class.lint (C:\Users\archc_000\.atom\packages\linter-coffeelint\lib\plus-linter.coffee:1:1)
  at C:\Users\archc_000\.atom\packages\linter\lib\editor-linter.coffee:69:26
  at currentLinter (C:\Users\archc_000\.atom\packages\linter\lib\editor-linter.coffee:68:20)
  at C:\Users\archc_000\.atom\packages\linter\lib\editor-linter.coffee:82:23
  at Set.forEach (native)
  at EditorLinter.triggerLinters (C:\Users\archc_000\.atom\packages\linter\lib\editor-linter.coffee:64:26)
  at C:\Users\archc_000\.atom\packages\linter\lib\editor-linter.coffee:57:27

from linter-coffeelint.

AsaAyers avatar AsaAyers commented on September 14, 2024

Cannot find module 'coffee-react-transform' from

It looks like you configured CoffeeLint to use coffee-react-transform but it isn't in your node_modules

from linter-coffeelint.

archcorsair avatar archcorsair commented on September 14, 2024

Wow, sorry. I blindly copy-pasted a commenter's code without looking at it. Face-palming for not seeing that. Works great now without coffee-react-transform
Thanks!

from linter-coffeelint.

ariririos avatar ariririos commented on September 14, 2024

If you can open a terminal and run coffeelint path/to/your/file.coffee and it picks up the config but linter-coffeelint doesn't, then there's a bug that I will fix ASAP.

This is happening to me. The file I am editing and coffeelint.json are in the same directory (the project root), but none of the options are applied (i.e. I still get errors related to max line length even though I have "max_line_length": {"level": "ignore" } in coffeelint.json). There is nothing relevant in the console.

Edit: The only way I found to fix this was by putting coffeelint.json in my home directory. It would be great to be able to use different configurations per project, but it's okay.

from linter-coffeelint.

AsaAyers avatar AsaAyers commented on September 14, 2024

@rioc0719 I just published a patch. There was a bug that caused linter-coffeelint to look for your config relative to the directory the file was in, instead of relative to the file. Since I keep coffeelint.json in the root of my projects and my source lives in src or lib I didn't notice.

from linter-coffeelint.

ariririos avatar ariririos commented on September 14, 2024

@AsaAyers Thanks! The patch fixed the problem perfectly.

from linter-coffeelint.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.