Does anyone know how to properly setup eslint with prettier in Atom editor?
I wanted to use airbnb presets, but when I check ESlint integration in prettier settings, after I save my file, I have trailing commas after some functions, and other strange issues. How to set it up to make prettier respect airbnb rules after file save?
You may want to check out https://github.com/prettier/prettier-eslint
From the description:
The problem
The fix feature of eslint is pretty great and can auto-format/fix much of your code according to your ESLint config. prettier is a more powerful automatic formatter. One of the nice things about prettier is how opinionated it is. Unfortunately it's not opinionated enough and/or some opinions differ from my own. So after prettier formats the code, I start getting linting errors.
This solution
This formats your code via prettier, and then passes the result of that to eslint --fix. This way you can get the benefits of prettier's superior formatting capabilities, but also benefit from the configuration capabilities of eslint.
For files with an extension of .css, .less, .scss, or .json this only
runs prettier since eslint cannot process those.
Just be aware that prettier-eslint for Atom has been depreciated and prettier-atom doesn't support the Airbnb style guide.
Related
Can anyone provide a solution as to why this repo will not run the test?
https://github.com/robport/nextjs-solana
If you need to make it work, this is a solution. Basically jest does not like to work with file in "newer" js formats (specifically, it does not like import or export statements, that is what it is complaining about in the message when you run yarn test).
I will cite jest documentation to be more clear, you can find it at this link
Sometimes it happens (especially in React Native or TypeScript projects) that 3rd party modules are published as untranspiled code. Since all files inside node_modules are not transformed by default, Jest will not understand the code in these modules, resulting in syntax errors. To overcome this, you may use transformIgnorePatterns to allow transpiling such modules.
"jest --transformIgnorePatterns"
Calling the script with the parameter alone solves your issue. However, you should specify the exact regex to avoid transpiling everything.
Check also this to investigate more.
I recently started using Atom IDE on Linux and I really like it. But I have come to small annoyance while developing a web2py application. I have installed linter and have tried several python extensions for linter (linter-python, pylint, etc.) but I can't seem to configure any of the linters to ignore the global web2py identifiers, which is really annyoing because they are used a lot. E.g. the "response" and "request" names are always shown as errors.
In my research I found a solution for the sublime-text IDE which I don't own: https://gist.github.com/maribo/4086469
Does anybody know if there is a similar solution in Atom or if there is any other package I can use?
Thanks in advance
If you cannot get the linter configured as desired, you might also try adding the following line to your files:
from gluon import *
That imports all the web2py API globals, including creating some dummy objects.
We are running static analysis tests on two points:
On Git pre-commit hook, and in that case we are using phpcs, phpmd, stylelint and eslint engines (vanilla installations + Drupal Coder for Drupal standards addition)
Once in a week we are updating our project's dashboard on SonarQube, which runs the following quality profiles: Drupal (PHP), JS and SCSS
We want to align our standards to a single standard, but using different engines makes it much harder (or even impossible?).
I can think of some possible ways to achieve that:
Manually align the rules on both pre-commit and SonarQube
Use SonarQube for our pre-commit tests
I'm not sure about that, since by looking at the Drupal standards at SonarQube, it seems like there are much less rules there than on the Drupal PHPCS standards (from Drupal Coder) - relevant question I found about it
(also another relevant question about aligning SonarQube's PHP plugin with phpCS)
Create a custom plugin for SonarQube with our engines set (no way..)
The ideal solution in my way of thinking is to have SonarQube read the rules files (e.g. phpcs.dist.xml) in the Git repo just like most of the static analysis tools out there.
I also saw the SonarQube and stylelint Rule Mapping - which is the only mapping I found about those engines.
How can we overcome that issue in the simplest way?
You can use PHPStan in your CLI, the same way you probably use coding standard checks or PHPUnit tests:
vendor/bin/phpstan analyse src --level=0
Set this in your pre/post-commit hook and you are ready to go.
Read more in short post about first install of PHPStan
I'm trying to install Basscss CSS framework in my webpack/react app, I'm fairly new to this workflow.
When I run 'npm i basscss' I'm able to add:
require('basscss/css/basscss.css');
To my app entrypoint. However, I now need to add basscss-addons for further styling - so is the correct approach to add a require line for every single file in basscss-addons? Each addon is a separate file, and each addon's folder structure seems to be different.
It seems like there must be an easier way.
There is a method in this article that works, but it relies on cssnext and it throws warnings saying it's deprecated and that you need to upgrade to postcss instead.
So you would need to use postcss, postcss-basscss and postcss-import, I guess, but I couldn't make it work efficiently. I'd love to hear from someone who has a valid implementation with postcss...
I've being using JSLint for some time now and recently found JSHint. Reading the docs I learned that it can be configured using a .jshintrc file but I could not found if it's possible to generate this file using the CLI.
Is there a flag in the CLI to generate such file (preferably with all the options set) or another tool that allows me to do that?
Not really going to answer your question but I found the JShint I use on some article about code style guides, in a free HTML eBook SpeakingJS - Style guide.
They talk about Google's guideline, AirBNB's guideline, jQuery's guideline, and others, most of the time those links provide its a ready to use jshint file ... may be this could help you :).
If you want to generate your own JSHint, I don't know if you are familiar with Yeoman but this project is exactly what you re looking for : https://github.com/losingkeys/generator-jshint
After generating it, any text editor can be used to edit such a simple file.