eslint-config-serverless
v0.0.5
Published
A JavaScript Style Guide for Serverless ready to be used in multiple projects.
Downloads
24
Maintainers
Readme
eslint-config-serverless
An ESLint Shareable Config created on top of Airbnb JavaScript Style Guide
Note: I wrote a text explaining the rules applied by this project in Portuguese. Meu Controle De Qualidade Para Projetos Serverless Com Node.js
Install
This module is for advanced users. You probably want to use Airbnb JavaScript Style Guide instead :)
npm i eslint-config-serverless
Usage
NPM Script:
"scripts": {
"test": "npm run test:memory && npm run test:unit",
"test:unit": "jest --env=node --coverage",
"test:memory": "jest --env=node --logHeapUsage",
"test:report": "npm run test:unit --coverageDirectory='coverage' --coverageReporters='html'",
"lint": "eslint --format codeframe src",
"lint:report": "eslint -c .eslintrc.json -f html src/** > eslint.html"
},
ESLint:
Add the config to either the package.json
:
{
"eslintConfig": {
"extends": "eslint-config-serverless",
"rules": {
//your overrides
}
}
}
or to the .eslintrc.json
or .eslintrc.js
:
{
"extends": "eslint-config-serverless",
"rules": {
// your overrides
}
}
Ignoring Files and Directories:
You can tell ESLint to ignore specific files and directories by copying my .eslintignore file into your project’s root directory.
cp node_modules/eslint-config-serverless/.eslintignore .
EditorConfig:
If you are using the EditorConfig plugin in your IDE, you can copy the file into the root folder of your project:
cp node_modules/eslint-config-serverless/.editorconfig .
Prettier:
If you are using the Prettier plugin in your IDE, you can copy the file into the root folder of your project:
cp node_modules/eslint-config-serverless/.prettierrc .
JestConfig:
If you are using the Jest, you can copy the file into the root folder of your project:
cp node_modules/eslint-config-serverless/jest.config.js .
Assumptions
- The ESLint rules are based on the great work of airbnb's eslint-config-airbnb
- Created for Node.js environment
- Jest as the test-suite. It's already set up for you
- Prettier as code formatter. It's already set up for you
env
: Node environmentglobals
: added some jest-related variables