@nextpage/eslint
v1.1.2
Published
Corporate Neutrino preset with NextPage ESLint rules
Downloads
9
Readme
NextPage ESLint Preset
@nextpage/eslint
is a Neutrino preset that supports linting projects with ESLint config used in NextPage.
Features
- React support
- Vue support
- Accessibility linting in React and Vue
- JSON support
- Markdown code fragments linting
- other
Installation
npm install --save-dev neutrino eslint @nextpage/eslint
Quickstart
After adding the Atom Space preset to your Neutrino-built project, edit your project's package.json
and .neutrinorc.js
to add the preset for linting before your build presets. Make it the first in the list of presets
.neutrinorc.js
const eslint = require("@nextpage/eslint");
module.exports = {
use: [
eslint()
// put your rest of presets here
]
};
package.json
{
"scripts": {
"lint": "eslint ./src --fix",
"postinstall": "eslint package.json --fix"
}
}
Create a .eslintrc.js
file in the root of the project, containing:
.eslintrc.js
const neutrino = require("neutrino");
module.exports = neutrino().eslintrc();
Preset options
Configuration
If you wish to customize what is included, excluded, or any ESLint options, you can provide an options object with the preset and this will be merged with defaults. Define eslint
property to override ESLint configuration.
Example: Include a plugin, browser and Node environments and turn off semicolons from being required as defined by the Atom Space rules.
const eslint = require("@nextpage/eslint");
module.exports = {
use: [
eslint({
eslint: {
plugins: ["fp"],
env: {
browser: true,
node: true
},
rules: {
semi: "off"
}
}
})
]
};
VSCode tips
To enable ESLint in Visual Studio Code you should have the ESLint extension installed.
These are suggested workspace settings related to @nextpage/eslint
rules:
.vscode/settings.json
{
"git.ignoreLimitWarning": true,
"editor.insertSpaces": true,
"editor.detectIndentation": true,
"editor.tabSize": 2,
"jshint.enable": false,
"prettier.enable": false,
"editor.formatOnSave": false,
"javascript.format.enable": true,
"javascript.validate.enable": false,
"files.eol": "\n",
"files.insertFinalNewline": false,
"files.autoSave": "onFocusChange",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"eslint.options": {
"extensions": [".js", ".jsx", ".html", ".md", ".vue", ".json", ".jsonc", ".json5", ".json6"],
"resolvePluginsRelativeTo": "./node_modules/.pnpm"
},
"eslint.validate": ["javascript", "javascriptreact", "html", "markdown", "vue", "json", "jsonc", "json5", "json6"],
"vetur.validation.template": false
}
When project has been initially installed you need to restart an editor. After this ESLint will start to highlight and auto-fix errors in your code on file save.
Development of this project
Install all dependencies for local development
npm install
To auto-fix all ESLint violations
npm run lint
To show all ESLint errors without fixing
npm test
Release of a new version to NPM
All process is automated on CI/CD you just need to commit your changes and choose how you want to upgrade your version
Major upgrade
Peed dependencies changed, breaking changes in ESLint rules, removing ESLint plugins
npm version major
Minor upgrade
ESLint rules options changes, adding new plugins, removing rules
npm version minor
Patch upgrade
Fixing issues that are expected to work
npm version patch