Atom Nuclide: no Linting no Flow - atom-editor

Installed Nuclide for Atom, disabled the linter per their instructions and also I've installed the linter (?) per their instructions. Also I've generated an .eslintrc.js..
module.exports = {
"extends": "airbnb",
"plugins": [
"react"
]
};
..in my package.json, I have the following linters
"eslint": "^2.13.1",
"eslint-config-airbnb": "^10.0.0",
"eslint-plugin-babel": "^3.3.0",
"eslint-plugin-import": "^1.12.0",
"eslint-plugin-jsx-a11y": "^2.0.1",
"eslint-plugin-react": "^6.0.0",
Using Flow
#flow
var foo: number = '123424';
Using Flow ** sometimes ** works. Half the time Flow works when I start Atom (and restart Flow server), other times not at all. What can one do to make this feature less flaky and work all the time?
Using Lint
Doesn't ever work. Apparently Lint will work via Diagnostic feature, but it doesn't. What steps does one need to take to have linting in Nuclide? Thanks!
I have eslint install globally.v3.2.2

I went through something similar, so I'll post this finding in response to what could have possibly been going on. I am running OS Sierra #10.12.4 with the most recent version of nuclide, atom, and flow#0.42.0. I'm using flow for a React Native project. I'm also using a linter config I found on npm. I noticed that the script below worked in my package.json with "flow-bin": "^0.42.0" in the dev dependency:
"flow-test": "flow; test $? -eq 0 -o $? -eq 2"
However, the little spinner in the lower right of the editor was showing that it was waiting for flow for a while and then would time out. I came across this article on this issue and saw that I needed to brew install flow and make sure the ocaml dependencies were properly installed as well (this shows up after the brew install). After doing this, the flow diagnostic feature works even with linter and linter-eslint packages enabled.

For me I had to delete my .atom folder in my home directory, then re-install all the packages. It was annoying, and I would keep a list of your packages before deleting this folder.
rm -rf ~/.atom

Related

Error: Chromium revision is not downloaded. Run "npm install" or "yarn install"

I am trying to run the following command but I am getting the error like
pa11y http://example.com/ # Trying to run this on my terminal
Welcome to Pa11y
------------------------
Error: Chromium revision is not downloaded. Run "npm install" or "yarn install"
at Launcher.launch (/usr/lib/node_modules/pa11y/node_modules/puppeteer/lib/Launcher.js:119:15)
at async runPa11yTest (/usr/lib/node_modules/pa11y/lib/pa11y.js:106:29)
at async pa11y (/usr/lib/node_modules/pa11y/lib/pa11y.js:55:19)
at async runProgram (/usr/lib/node_modules/pa11y/bin/pa11y.js:122:19)
I spent around 3-4 hours to fix this but no luck. I have tried every possible solution on the internet which is posted by others who had faced similar errors.
Any help in this regard is helpful
Two questions:
Do you have Chromium installed? pa11y doesn't think so! It could be a wrong version installed if so, or installed in a way that pa11y can't find.
What OS are you running?
The answer to your question depends on your Operating System, because the version of Chromium you need is specific to your OS! If you're running Linux Alpine,
the command would be something like this:
apk add -U --no-cache --allow-untrusted udev ttf-freefont chromium git
I had this problem when trying to run the Node package puppeteer (which uses Chromium) in a Docker container running node 12 alpine. I spent all weekend (yes...) to come to the 1 line (yes...) I needed. It turned out I needed to add the above line to my Dockerfile, which installs the necessary fonts and libraries and installs Chromium.
I also had to tell Puppeteer to skip installing Chromium, but I don't think that's applicable to your situation.
If you're running something other than Linux, check out these instructions for installing Chromium: https://www.chromium.org/getting-involved/download-chromium

How to install NPM package from GitHub for Meteor?

I have forked an npm package on GitHub, made changes to it, and now want to install the package in my Meteor app directly from GitHub.
My package.json looks like so:
{
"dependencies": {
"semantic-ui-react": "git+https://git#github.com/nolandg/Semantic-UI-React.git",
}
}
I then run
meteor npm install
Which appears to work fine and tells me it's installed the package:
semantic-ui-react#0.61.6 (git+https://git#github.com/nolandg/Semantic-UI-React.git#f27d5c736e5de1eed0acf7769f18caee57578526)
And indeed the package appears in the node_modules folder. But when I try to start my Meteor app, I get this error:
Cannot set property '/my-website/node_modules/semantic-ui-react/package.json' of undefined
at Resolver._resolvePkgJsonMain (/tools/isobuild/resolver.js:320:9)
Has anyone successfully install an npm package in a Meteor app directly from GitHub? I can't figure this one out. Thanks!
Meteor version: 1.4.2.3
The main reason why the package does not work when fetching from git is because it is not configured to work that way. This is not a Meteor specific problem, but a problem that a JS developer may face sometimes.
For this particular case there are two problems:
The whitelist files field in package.json only contains src and dist folder. That means when you fetch it by npm almost all config files needed to build the code are gone.
Code for this package requies to be built in order to work with your code. This is done when the author publish it to npm, but you fetch it directly from github so this step is undone.
Because you already folked and modified the package, so let modify the package.json as below (remove all the comments I added them to give you some explanation), push it to github, and fetch it again by npm:
// remove the "files" field
// ...
"scripts": {
// this script is used to build the package
"postinstall": "postinstall-build dist \"npm run build:commonjs\""
// ...
},
"dependencies": {
// this helps build the package
"postinstall-build": "^2.1.3"
},
// ...
Packages are not usually installed from github, they are published, which means that many versions of a package are available, you can choose which one you get. I'm not sure if what you are doing is possible, but it's certainly inadvisable.
If you want to make changes to a github package, you can download the it to your local machine and do npm link, so that it uses your local package instead of the one on npm. Read more about it at https://docs.npmjs.com/cli/link
Why do you not use simple command?
meteor npm install https://github.com/nolandg/Semantic-UI-React.git
I did:
meteor create test
cd test
meteor npm install
meteor add react react-dom
meteor npm install https://github.com/nolandg/Semantic-UI-React.git
meteor
And no errors (-:

How to address node-sass regression(?) "It's not clear which file to import for #import"

It seems that a recent version of node-sass (3.4.1) breaks our build. I am consistently getting this error message:
It's not clear which file to import for '#import "../file"'.
Candidates:
../file.scss
../file.css
Please delete or rename all but one of these files.
Now, this is occuring for all the files in the project that have not explicitly specified "file.scss" in their name.
I have not been able to determine a fix for this bug - Nor can I find any documentation to address what has changed in node-sass to cause it. We have too many files for it to be practical to go rename each import.
Can someone point me in the right direction?
Edit:
This is also happening with files which have an underscore (eg. _file) in their path. Doesn't seem to recognize that these files are partials.
I had the same problem, but only with node-sass version 3.4.2. Version 3.4.1 was working ok for me.
It seems this is a known issue in node-sass - https://github.com/sass/node-sass/issues/1222 however its not clear exactly which versions are affected.
I fixed it by uninstalling grunt-sass, then installing the exact version of node-sass that worked correctly (v3.4.1), and then finally reinstalling grunt-sass.
$ npm uninstall grunt-sass
$ npm install node-sass#3.4.1 --save-dev
$ npm install grunt-sass
This means grunt-sass uses your installed version, rather than installing its own version which it defines as "node-sass": "^3.4.0"
Weirdly even though I specified an exact version in the install command I still ended up with this in my package.json:
"node-sass": "^3.4.1"
So I manually changed that to the exact version so other developers in the team would get the correct version:
"node-sass": "3.4.1"
Of course if you find that the only version that works for you is v3.3.0 then use that that version in the instructions above.
Option 1
You can import using the file extension
#import "../file.scss"
Option 2
Or you can tell SASS not to generate the .css file by import without output. You have to rename the file from file.scss to _file.scss
That will let you import like this
#import "../file"
I prefer option 2 as it reduces the number of css files you have to keep track of.

Cache global node_modules on travis in the correct directory

I'm using grunt-cli on travis to execute tests. It's installed globally during the install step like this:
install:
# amongst other install steps
- npm list -g grunt-cli --depth=0 || npm install -g grunt-cli
and then I'm caching it, like this, per this question (which, incidentally, I answered):
cache:
directories:
- $(npm config get prefix)/bin/grunt-cli
However, on the next build, I see this: tar: /home/travis/.nvm/v0.10.36/bin/grunt-cli: Not found in archive. And the reason is, grunt-cli gets cached in .nvm/v0.10.40/ because that's what version of node is being tested against (mostly by default - we just have node_js: 0.10 set in the config, so it installs the most recent version). But apparently the starting version of node on travis is 0.10.36. Obviously, there are ways around this, but this seems like extremely naive behavior. I mean, travis does the cache first, then nvm installs the right version of node rendering the initial cache useless. Maybe they just didn't have global node_modules in mind for caching. Is there something I'm missing with configuration? Or should I just npm config set prefix to a version-independent path and add it to my $PATH? (Or alternatively, use a fully qualified version - major.minor.patch - and hard-code the cache directory?)

Meteor package pre-build npm module with browserify

I have an npm module I want to wrap in Meteor package, and work with it on client side and server side both. This npm module isn't shipped with built 'dist' file but with sources only instead and npm build script, so it is supposed to be built with browserify or webpack.
package.json contains npm build script for minimized package:
"scripts": {
"prod": "browserify ./index.js -x react | uglifyjs > ./dev/prod.js"
},
I want to execute this script (or my own) and only then do
Package.onUse(function(api) {
api.addFiles('../somenpmfolder???/dev/prod.js', ['client', 'server']);
}
Obviously just Npm.require wouldn't work as it doesn't work when executed on client.
I can build script manually and just shove dist inside my package but it isn't right way doing things. I leave it as a last resort for myself.
This is half of answer on my question: https://stackoverflow.com/a/17081463/2123547
What I want to have next is this pre-build stage.
There's a new package appeared that does browserify job. I checked it and it work well for me.
https://github.com/elidoran/cosmos-browserify/

Resources