eslint-plugin-nativescript
v0.0.0
Published
A set of ESLint rules for NativeScript projects.
Maintainers
Readme
NativeScript ESLint Rules
This project contains ESLint rules useful for NativeScript projects.
TypeScript Project Setup
- Install the necessary dependencies:
npm i -D eslint-plugin-nativescript @typescript-eslint/parser eslint- Add an
.eslintrcconfig file:
.eslintrc
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"sourceType": "module"
},
"plugins": ["nativescript"],
"rules": {
"nativescript/no-short-imports": "error"
}
}- Lint the project from the command line:
npx eslint --ext=ts src/Notice that you need to provide the path to your source code. In the example above, that's src/. Change it to match your project
- Fix all auto-fixable problems:
npx eslint --ext=ts --fix src/- [Optional] Set up VSCode to use
eslint.
- Install the
dbaeumer.vscode-eslintextension. - Add the following to your
settings.jsonfile:
"eslint.validate": [
{
"autoFix": true,
"language": "typescript"
},
{
"autoFix": true,
"language": "javascript"
}
]JavaScript Project Setup
- Install the necessary dependencies:
npm i -D eslint-plugin-nativescript eslint- Add an
.eslintrcconfig file:
.eslintrc
{
"parserOptions": {
"ecmaVersion": 2015
},
"plugins": ["nativescript"],
"rules": {
"nativescript/no-short-imports": "error"
}
}- Lint the project from the command line:
npx eslint app/Notice that you need to provide the path to your source code. In the example above, that's app/. Change it to match your project
- Fix all auto-fixable problems:
npx eslint --fix app/- [Optional] Set up VSCode to use
eslint.
- Install the
dbaeumer.vscode-eslintextension. - Add the following to your
settings.jsonfile:
"eslint.validate": [
{
"autoFix": true,
"language": "javascript"
}
]