godaddy / javascript Goto Github PK
View Code? Open in Web Editor NEWThe official GoDaddy JavaScript styleguide.
License: MIT License
The official GoDaddy JavaScript styleguide.
License: MIT License
Currently the lock files point to the private artifactory server. Need to regenerate those using npm registry and do a patch publish
I have attempted to follow the directions for adding it to our project, but running any of the commands with npm run <script>
results in
events.js:85
throw er; // Unhandled 'error' event
^
I assume that events.js is from one of the node_modules that this depends on because we do not have an events.js file in our code. I changed the lib/
to src/
in the script command because we don't have a lib folder, and got the same behavior. npm error information looks like this:
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "c:\\Program Files\\nodejs\\node.exe" "c:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "lint"
npm ERR! node v0.12.7
npm ERR! npm v2.11.3
npm ERR! code ELIFECYCLE
npm ERR! <our package name>@1.0.0 lint: `godaddy-js-style-lint src/ test/`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the <our package name>@1.0.0 lint script 'godaddy-js-style-lint src/ test/'.
npm ERR! This is most likely a problem with the <our package name> package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! godaddy-js-style-lint src/ test/
I noticed that there is a situation in ES6 where properties of an object literal are declared without the function
keyword and because object keys are not allowed to have space afterwards, but opening round braces are not permitted to NOT have whitespace before, there is a situation created that causes issues with autofix and cannot be resolved manually either.
https://github.com/godaddy/javascript/blob/master/dotfiles/.jscsrc#L279
https://github.com/godaddy/javascript/blob/master/dotfiles/.jscsrc#L70
npm ERR! node v7.5.0
npm ERR! npm v4.1.2
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! [email protected] postinstall: `run-p install:config install:config:es5 install:config:react`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the [email protected] postinstall script 'run-p install:config install:config:es5 install:config:react'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the godaddy-style package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! run-p install:config install:config:es5 install:config:react
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs godaddy-style
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls godaddy-style
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/V1/Projects/ux/svgs/npm-debug.log
The run-p
command does not exist on my system so it fails to install .
FYI - Installed the latest version (3.1.3), I'm getting the following error:
Error: Cannot find module '../es5-paths'
A bug was introduced in the latest version of eslint
(2.3.0), preventing us from running the style guide.
Running eslint with options: -c godaddy-style/dist/.eslintrc server common test
Error: Cannot find module 'estraverse-fb'
See issue: eslint/eslint#5476
I'm sure this issue will be fixed in a couple days, but I wonder whether it would be wise to lock the dependencies in the package.json
(i.e. change "eslint": "^2.1.0"
to "eslint": "2.2.0"
).
I tend to run into less issues when controlling which versions I'm using. Just a suggestion :)
Minimal repro here: https://github.com/gisenberg/eslint-godaddy-react-repro
node: v6.0.0
npm: v3.8.6
When running eslint-godaddy-react
on Windows, the script execution fails. Example output below:
gdlint:
C:\Users\gisenberg\git\eslint-godaddy-react-repro (master) ([email protected])
λ npm run gdlint
> [email protected] gdlint C:\Users\gisenberg\git\eslint-godaddy-react-repro
> eslint-godaddy-react src/
C:\Users\gisenberg\git\eslint-godaddy-react-repro\node_modules\.bin\eslint.CMD:1
(function (exports, require, module, __filename, __dirname) { @IF EXIST "%~dp0\node.exe" (
SyntaxError: Unexpected token ILLEGAL
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:511:25)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:456:32)
at tryModuleLoad (module.js:415:12)
at Function.Module._load (module.js:407:3)
at Module.require (module.js:466:17)
at require (internal/module.js:20:19)
at C:\Users\gisenberg\git\eslint-godaddy-react-repro\node_modules\eslint-config-godaddy\cli.js:41:7
at C:\Users\gisenberg\git\eslint-godaddy-react-repro\node_modules\which\which.js:87:20
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "gdlint"
npm ERR! node v6.0.0
npm ERR! npm v3.8.6
npm ERR! code ELIFECYCLE
npm ERR! [email protected] gdlint: `eslint-godaddy-react src/`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] gdlint script 'eslint-godaddy-react src/'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the eslint-godaddy-react-repro package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! eslint-godaddy-react src/
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs eslint-godaddy-react-repro
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls eslint-godaddy-react-repro
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\gisenberg\git\eslint-godaddy-react-repro\npm-debug.log
eslint:
C:\Users\gisenberg\git\eslint-godaddy-react-repro (master) ([email protected])
λ npm run eslint
> [email protected] eslint C:\Users\gisenberg\git\eslint-godaddy-react-repro
> eslint src/
C:\Users\gisenberg\git\eslint-godaddy-react-repro (master) ([email protected])
λ
We have the following npm script in our package.json
:
"scripts": {
"lint_local": "godaddy-js-style-eslint -c .eslintrc server common test && godaddy-js-style-jscs server common test",
"lint_jenkins": "godaddy-js-style-eslint -c .eslintrc -f checkstyle server common test -o checkstyle-eslint.xml && godaddy-js-style-jscs -r checkstyle server common test > checkstyle-jscs.xml"
}
In Jenkins, we run npm run lint_jenkins
. We expect that checkstyle-eslint.xml
and checkstyle-jscs.xml
will be reporting style issues. But instead because --fix
is set by default by godaddy-js-style-jscs
, our source files get fixed during the build. This is not the desired behavior.
Would you guys accept a PR adding an option to disable auto-fix? I'm not sure how it would play with fashion-show
(might be tricky). The change would be backward-compatible, and would allow us to stop our build if the style guide is not respected.
Are these plugins required? I'm using the second approach defined here using a .eslintrc
file and I get an error about missing these dependencies. I'm not using mocha in my project (using ava), and I'm not linting any json files, so having these dependencies seem overkill.
.eslintrc
{
"root": true,
"parser": "espree",
"parserOptions": {
"ecmaVersion": 5,
"sourceType": "script"
},
"env": {
"es6": false
}
}
Hi all,
The JSCS team announced a couple months ago that they are not maintaining their project anymore (see https://medium.com/@markelog/jscs-end-of-the-line-bc9bf0b3fdb2):
We came to the realization that ESLint and JSCS are really solving the same set of problems in very similar ways. The community seems to want to use a single linter, and we want to help that become a reality.
Therefore I am wondering if it still makes sense to have an abstraction layer for those two linting tools?
As an API developer writing code in Node only, I ran into several issues using this package:
fashion-show
(see #28).Since JSCS is now deprecated, I wonder if this project should simply contain the following:
That way the entire company could use it and align on a base style. Each team would install ESLint directly in their project (locally or globally). Each project would extend the base ESLint configuration files such as:
{
"extends": "./node_modules/godaddy-js-style-guide/.eslintrc-base",
"globals": {
"myProjectGlobal": true
},
"rules": {
"max-params": 0, // because I <3 params!
}
}
Just my $0.02, cheers! :)
From recommended rules the package itself exports:
"react/display-name": 2,
"react/jsx-no-duplicate-props": 2,
"react/jsx-no-undef": 2,
"react/jsx-uses-react": 2,
"react/no-danger": 2,
"react/no-deprecated": 2,
"react/no-did-mount-set-state": [2, "allow-in-func"],
"react/no-did-update-set-state": [2, "allow-in-func"],
"react/no-direct-mutation-state": 2,
"react/no-is-mounted": 2,
"react/no-unknown-property": 2,
"react/prop-types": 2,
"react/react-in-jsx-scope": 2,
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.