Prettier - Atom editor replacing single quotes with double quotes - atom-editor

I am having an issue with prettier code formatter, It is replacing single quotes with the double quotes. Previously it was working very well but I updated the system and now having this issue.
Here's my prettier configuration in config.cson
"prettier-atom":
formatOnSaveOptions:
respectEslintignore: false
showInStatusBar: true
prettierEslintOptions: {}
prettierOptions:
singleQuote: true
trailingComma: "es5"
useTabs: true
useEslint: true
useStylelint: true
and this is my .prettierrc
{
"semi": false,
"printWidth": 125,
"singleQuote": true,
"trailingComma": "all"
}
Not sure whats went wrong.

I haven't had space to dig into this issue very deep but to restart atom with that config setup which you have can solve your problem. It worked for me.
This link will be helpful

Related

How do I stop Atom from getting rid of all the empty space at the bottom when I save? [duplicate]

I use Sublime text. Now I am trying Atom. When I save any file in sublime text it does not include any trailing blank line. But saving any file in Atom leaves a trailing blank line. How do I force Atom not to leave trailing white spaces?
Under your Atom Preferences go to Packages tab and search for whitespace. Click on the whitespace package and uncheck Ensure Single Trailing Newline option
On global level this can be changed using settings in Whitespace package, but if you want to disable it for a specific language you have to use syntax-scoped properties in your config.cson.
'.text.html.php': # php overrides
whitespace:
ensureSingleTrailingNewline: false
removeTrailingWhitespace: false
'.source.ruby': # ruby overrides
whitespace:
ensureSingleTrailingNewline: false
removeTrailingWhitespace: false
To see the scope of language go to Packages tab and search for your language.
Click on the settings of the language package and you can see the scope:
Go to packages and find "whitespace", go to it's settings and uncheck the last checkbox.
Settings
Checkbox
To add to Dan Moldavan's answer.
I experienced this issue when working on a Rails Application.
I added a .editorconfig file with the following properties:
# editorconfig.org
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
And I added a .gitattributes file with the following properties:
# Enforce Unix newlines
* text=auto eol=lf
And then my Atom Editor threw a problem:
1 problem affecting .gitattributes
whitespace: It is possible that the "whitespace"-package prevents the following properties from working reliably: insert_final_newline, trim_trailing_whitespace. You may try reconfiguring or disabling the "whitespace"-package to solve regarding issues.
Here's how I fixed it:
Open your Atom Editor
Go to Edit > Preferences > Packages
Type in whitespace
Click on the package that shows up
Untick the following:
Ensure Single Trailing Newline
Ignore Whitespace On Current Line
Leave Ignore Whitespace Only Lines unticked
Save and close the settings.
That's all.
I hope this helps

how to exclude property-sort-order from scss-lint rules?

I have a sasslint.yml file with a a list of rules
One of them is
property-sort-order: 1
I have tried to exclude it with
property-sort-order: enabled:false
and with
scss-lint --exclude-linter PropertySortOrder
But all this unsuccessful.
Any ideas?
Many thanks
You configure scss-lint in yml a configuration file. The default is .scss-lint.yml, and you can specify a different file via the command line with --config (I think -c works too). The documentation covers this here: https://github.com/brigade/scss-lint#configuration
You disable a linter with
linters:
LinterName:
enabled: false
Judging by https://github.com/brigade/scss-lint/issues/132,
linters:
PropertySortOrder:
enabled: false
will work correctly.
If you'd actually rather not turn it off completely, configuration options for scss-lint's property-sort-order are documented here https://github.com/brigade/scss-lint/blob/master/lib/scss_lint/linter/README.md#propertysortorder

Grunt htmlmin clean-css breaking my Handlebars code within <style></style> tags

I have minifyCSS set to true in my Gruntfile.js htmlmin section like so:
htmlmin: {
dist: {
options: {
removeComments: true,
collapseWhitespace: true,
minifyJS: true,
minifyCSS: true
...
But unfortunately, it is now mangling some of my Handlebars code, turning this:
<style type="text/css">
{{#each list}}
.aClassWithBgImage{{#index}}{background-image:url({{images.thumbnailBoxImage}})}
{{/each}}
</style>
into this:
<style type="text/css">{background-image:url({{images.thumbnailBoxImage}})}</style>
...when really what I wanted (was expecting) is this:
<style type="text/css">{{#each list}}.aClassWithBgImage{{#index}}{background-image:url({{images.thumbnailBoxImage}})}{{/each}}</style>
Any quick fixes for this? Otherwise, I'm sure I can just restructure my code differently
With help from this answer here, I've discovered that there is an ignoreCustomFragments option within the html-minifier documentation. Using it, you can tell htmlmin to skip trying to compress your {{}} tags, using code like this in your Gruntfile.js:
htmlmin: {
...
options: {
ignoreCustomFragments: [/<%[\s\S]*?%>/, /<\?[\s\S]*?\?>/, /{{[\s\S]*?}}/], //last item in array is the one for Handlebars. The previous 2 items are the default code tags to be ignored, listed in the documentation
...
So the key part is adding the /{{[\s\S]*?}}/ RegEx. (You could, of course, just replace the whole ignoreCustomFragments array with that one RegEx if you wanted to.) NOTE: You might want to escape the curly braces '{}' in the RegEx, but it seems to work fine without.
UPDATE
So actually, the /{{[\s\S]*?}}/ RegEx seems to leave a space " " in my code... and if I change it to /{{.*}}/ , the spaces are removed, but some of my CSS styling becomes uncompressed... so for now, I consider these 2 RegExs somewhat of a "half-solution" . I also tried using customAttrSurround as listed in the Wiki but I couldn't even get that code to work at all in my Gruntfile.js .

Sublime ignores eslint settings

I am using the standard linter via the SublimeLinter-contrib-eslint package and it seems to ignore these entries in both SublimeLinter.sublime-settings and ~/.eslintrc:
{
"globals": {
"describe": true,
"it": true,
"expect": true,
"angular": true
}
}
I am still getting these globals as undefined.
Any other way to declare them?
I'm not sure about SublimeLInter.sublime-settings, but ~/.eslintc file will only be used if no other eslint config files are found. Since you are using standard, I assume that you have another .eslintrc file somewhere. You will have to add those globals there.

Atom Editor, Set default syntax for erb files: HTML(Rails) over HTML(Ruby - erb)

I just spent the last hour going through Atom forums looking for an answer for this. Has anyone figured it out yet?
core:
customFileTypes:
"text.html.ruby": [
"erb"
]
Add above to config.cson and restart atom.

Resources