-
Notifications
You must be signed in to change notification settings - Fork 8
Conversation
Major rewrite in ES2015, including: * Clicking a rule name will now open the documentation * Disable on the fly linting! * The file copying method used before wasn't complete enough to cover all edge cases and was just causing problems. * Fix a race condition where file contents are changed after the lint is triggered * Move configuration to `configSchema` in `package.json`
@jschroeder9000 If you're still active here I'd love to have this looked over and your thoughts on the changes it is making. |
ignored_cops: | ||
- Style/FinalNewline | ||
- Style/TrailingBlankLines | ||
- Style/EndOfLine |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason this rule was triggering on all of the files for me, causing issues for the "valid" one. Unfortunately even though the other two are defined in the defaults and shouldn't be necessary here, it doesn't work without them.
"license": "MIT", | ||
"engines": { | ||
"atom": ">=1.0.0 <2.0.0" | ||
"atom": ">=1.4.0 <2.0.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Atom v1.4.0 was the first version to support the configSchema
.
// Add the file to be linted | ||
parameters.push(filePath); | ||
|
||
return helpers.exec(executablePath, parameters, options).then((output) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make it an async function and await it instead? It'll save you from deeper nesting for so many lines
'to update the results.', | ||
dismissable: true, | ||
}; | ||
atom.notifications.addWarning(warnMessage, warnOptions); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a console warning because this is too loud (as discussed privately)
} | ||
|
||
const messages = []; | ||
let match = regex.exec(output); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code is duplicated here and at at line 94. You could make it like while ((match = regex.exec(output)) !== null )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That means you are assigning in the conditional of the while
, which is against the code style guide.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally don't think it's wrong. Besides the code style guide was not given to us by God so we are free to object and change it to something that helps us keep the codebase clean and unduplicated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I personally agree with the code style guide so I'm keeping it the way it is 😛.
"atom": ">=1.4.0 <2.0.0" | ||
}, | ||
"configSchema": { | ||
"hamlLintExecutablePath": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make it just executablePath
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this will be a major release, that sounds like a good idea.
Rename the configuration option to match all the other linters.
As the Atom notification might be too intrusive for a non-critical issue, move this to the console.
Technically this makes it ES2017, but Atom supports this via Babel.
Conflicts: README.md
Giving this another day before merging. |
Thanks for your work on this, @Arcanemagus. I think this is a great start, though I find the decision to remove support for on the fly linting very disappointing. I see that the linter is no longer using or even looking for a rubocop config at all. That will severely cripple the usefulness of the linter by always linting with rubocop defaults instead of the what the user/project desires. Haml-lint has added support for setting an environment variable to specify the path to the rubocop config file ( With that implementation in place and since no file copying is being performed, I think on the fly linting should remain in place. |
Open mouth, insert foot... Haml-lint will find the Since there is no longer any file copying and that was the reasoning for disabling on the fly linting, I guess I'm confused as to why it is still being disabled. I think the whole thing with hackily copying config files to a temp directory was a just a relic left over from the original linter plugin always copying files to a temp directory. |
The searching for the file is left in to support the "global config file" option, otherwise we don't know if we need to specify our special one from the settings or not.
I assumed from the fact that it was being copied in the first place that |
Ah, I had forgotten the issue with STDIN. It's all coming back to me now. Haml-lint does not support linting from STDIN and I agree simplifying things and disabling on the fly linting is the way to go. I think this looks good and linking to the documentation is definitely a cool addition. 👍 from me. |
Published as v2.0.0! 🎉 |
Major rewrite in ES2015, including:
configSchema
inpackage.json
The new regex was validated here: https://regex101.com/r/EVwEiU/1
Fixes #30.
Fixes #16.
Closes #13.
Fixes #12.