Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@scandipwa/eslint-plugin-scandipwa-guidelines

Package Overview
Dependencies
Maintainers
2
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@scandipwa/eslint-plugin-scandipwa-guidelines - npm Package Compare versions

Comparing version 1.0.1 to 1.2.0

docs/rules/derived-class-names.md

28

package.json
{
"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
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc