Official GoDaddy JavaScript styleguide. It includes eslint
packages for various use-cases and can be used as a standard in any new project.
eslint-config-godaddy
: Base configuration for non-React, ES6 JavaScript applicationseslint-config-godaddy-react
: Configuration for ES6 React JavaScript applicationseslint-config-godaddy-typescript
: Configuration for ES6 TypeScript applicationseslint-config-godaddy-react-typescript
: Configuration for ES6 React JavaScript applicationseslint-config-godaddy-flow
: Configuration for ES6 React JavaScript applications using Floweslint-config-godaddy-react-flow
: Configuration for ES6 React JavaScript applications using Flow
There are many useful features:
- Standard. No configuration. – Stop worrying about style and focus on your work.
- Modern – Uses modern linting tools like
eslint
. - Auto-fix – Auto-fix is enabled by-default through in
eslint
. Many rules will fix themselves!
This styleguide is used by dozens of product teams at GoDaddy. Have a question or comment? Open an issue!
Install one of the provided packages depending on the kind of application you are developing:
# Default with ES6
npm i eslint-config-godaddy --save-dev
# OR (ES6 with React rules)
npm i eslint-config-godaddy-react --save-dev
# OR (legacy ES5 with React rules)
npm i eslint-config-godaddy-es5 --save-dev
# OR (ES6 with TypeScript rules)
npm i eslint-config-godaddy-typescript --save-dev
# OR (ES6 with React and TypeScript rules)
npm i eslint-config-godaddy-react-typescript --save-dev
# OR (ES6 with Flow rules)
npm i eslint-config-godaddy-flow --save-dev
# OR (ES6 with React and Flow rules)
npm i eslint-config-godaddy-react-flow --save-dev
There are two ways to use this styleguide depending on your own tooling preference: directly using pre-included binaries or running eslint
yourself with a custom .eslintrc
config.
These use exactly the configuration defined in the individual eslint-config-godaddy*
package with auto-fix enabled automatically.
{
"scripts": {
"lint": "eslint-godaddy files/ you/ want-to/ lint/"
}
}
module.exports = {
extends: 'godaddy',
rules: {
//
// Put any rules you wish to override here.
//
}
}
The --fix
option in eslint
is only available as a CLI option. Auto-fix will NOT be enabled unless you run eslint --fix
in your package.json
.
{
"scripts": {
"lint": "eslint --fix files/ you/ want-to/ lint/"
}
}
This section is a place for additional best practices that may be useful but are not strictly enforced by this styleguide. Have something to add here? Great! Submit a PR.
{
"extends": "godaddy",
"rules": {
// Disable the 'max-params' rule
"max-params": 0
}
}
{
"scripts": {
"eslint": "eslint-godaddy -c .eslintrc lib/ test/",
}
}
You may wish to disable auto fix so when you run eslint
in ci it will error
if it catches anything unlinted.
{
"scripts": {
"eslint:ci": "eslint-godaddy --fix=false --max-warnings=0 lib/ test/",
}
}
Fork this repository and submit a pull request.
For a first time setup make sure to run from the root of the monorepo
npm install
Since this repository uses npm workspaces it will install and hoist all node_modules
to
the root of the monorepo.
This repository utilizes changesets to handle versioning and publishing as you submit a pull-request. To initiate a changeset run:
npm run changeset
After which follow the command prompts to select which packages and which version each package should receive.
If you are lucky enough to get to publish a new version of a package you are in luck. This monorepo is setup to independently publish packages based on changes commited. Just make sure to run:
npm version
This will run changeset version
and will update all packages to the versions based on the changesets committed into the .changeset
directory. After the versioning is complete to handle publishing and creating a release run:
npm run release
This runs changeset publish
under the hood and handle as mentioned above.
Great. We'd love to talk about it. Fork this repository and submit a pull-request.
No problem. Reach out to us by opening an issue
- Consider other rules in an
eslint
only implementation:computed-property-spacing
generator-star-spacing
semi-spacing
block-spacing
- Continue to modularize the
eslint
rules. - Translate configuration files into more verbose written documentation.
- Add support for IDE formats (IntelliJ, Webstorm, Atom, Eclipse, Sublime, etc...)