@scandipwa/eslint-plugin-scandipwa-guidelines
Advanced tools
Comparing version 1.0.1 to 1.2.0
{ | ||
"name": "@scandipwa/eslint-plugin-scandipwa-guidelines", | ||
"version": "1.0.1", | ||
"version": "1.2.0", | ||
"description": "Eslint rules for ScandiPWA", | ||
"main": "index.js", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/scandipwa/eslint-plugin.git" | ||
}, | ||
"keywords": [ | ||
"eslint", | ||
"scandipwa" | ||
"eslintplugin", | ||
"eslint-plugin" | ||
], | ||
"author": "Jegors Batovs (yegor@scandipwa.com)", | ||
"license": "OSL-3.0", | ||
"bugs": { | ||
"url": "https://github.com/scandipwa/eslint-plugin/issues" | ||
"main": "lib/index.js", | ||
"scripts": { | ||
"test": "mocha tests --recursive" | ||
}, | ||
"homepage": "https://github.com/scandipwa/eslint-plugin#readme" | ||
"dependencies": { | ||
"requireindex": "~1.1.0" | ||
}, | ||
"devDependencies": { | ||
"eslint": "~3.9.1", | ||
"mocha": "^3.1.2" | ||
}, | ||
"engines": { | ||
"node": ">=0.10.0" | ||
}, | ||
"license": "OSL-3.0" | ||
} |
@@ -1,22 +0,51 @@ | ||
# Eslint plugin for ScandiPWA development | ||
# eslint-plugin-scandipwa-guidelines | ||
### Rule definitions | ||
Eslint plugin for ScandiPWA development | ||
* __`derived-class-names`__ Class name must match name of the file it is inside of. | ||
Expected class names for all the files _other_ than components are `name + prefix` (e.g. class inside of __AddToCart.container__.js file must be called __AddToCartContainer__ and not otherwise). | ||
* __`file-structure`__ File structure must comply to the following guidelines: | ||
* File structure must be flat, meaning that nesting components inside of other components is prohibited. | ||
* Extending root directory `src` with custom folders is prohibited. | ||
* File structure regulations imply having files with certain postfixes for certain functionality parts. Allowed postfixes are as follows | ||
* Component and route: `.component` `.container` `.style` | ||
* Store: `.action` `.dispatcher` `.reducer` | ||
* Query: `.query` | ||
* Style, type: __none__ | ||
* For files which are in their own directories with functionality related only to them (e.g routes, components), names should match the name of the directory these files are in. | ||
* __`use-extensible-base`__ All components should be extensible. For class to be extensible it should be derived from extensible base. Replacements of non-extensible bases are as follows and should not be imported - these are global. | ||
* `PureComponent` -> `ExtensiblePureComponent` | ||
* `Component` -> `ExtensibleComponent` | ||
* _`no base`_ -> `ExtensibleClass` | ||
* __`only-one-class`__ There should be only one class per file. Multiple classes inside of one file are not allowed. | ||
* __`no-non-extensible-components`__ Non-extensible components are not allowed. Use extensible bases instead of regular `Component` or `PureComponent`. | ||
* __`use-middleware`__ Wrap default export classes in `middleware` function in order to make classes extensible and assign namespaces to them. | ||
## Installation | ||
You'll first need to install [ESLint](http://eslint.org): | ||
```bash | ||
npm i eslint --save-dev | ||
``` | ||
Next, install `@scandipwa/eslint-plugin-scandipwa-guidelines`: | ||
```bash | ||
npm install eslint-plugin-scandipwa-guidelines --save-dev | ||
``` | ||
**Note:** If you installed ESLint globally (using the `-g` flag) then you must also install `@scandipwa/eslint-plugin-scandipwa-guidelines` globally. | ||
## Usage | ||
Add `scandipwa-guidelines` to the plugins section of your `.eslintrc` configuration file. You can omit the `eslint-plugin-` prefix: | ||
```json | ||
{ | ||
"plugins": [ | ||
"scandipwa-guidelines" | ||
] | ||
} | ||
``` | ||
Then configure the rules you want to use under the rules section. | ||
```json | ||
{ | ||
"rules": { | ||
"scandipwa-guidelines/rule-name": 2 | ||
} | ||
} | ||
``` | ||
## Supported Rules | ||
* Fill in provided rules here | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
24872
21
561
52
1
1
2
1
+ Addedrequireindex@~1.1.0
+ Addedrequireindex@1.1.0(transitive)