-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 171f03b
Showing
15 changed files
with
1,392 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# top-most EditorConfig file | ||
root = true | ||
|
||
# Unix-style newlines with a newline ending every file | ||
[*] | ||
end_of_line = lf | ||
charset = utf-8 | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 2 | ||
trim_trailing_whitespace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"root": true, | ||
"extends": [ | ||
"@jenssimon/base" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules/ | ||
yarn-error.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2019 Jens Simon | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
[![NPM version][npm-image]][npm-url] [![Downloads][npm-downloads-image]][npm-url] [![Dependencies][deps-image]][deps-url] [![devDependencies][deps-dev-image]][deps-dev-url] [![peerDependencies][deps-peer-image]][deps-peer-url] [![star this repo][gh-stars-image]][gh-url] [![fork this repo][gh-forks-image]][gh-url] ![Code Style][codestyle-image] | ||
|
||
# eslint-config-sfcc | ||
|
||
> A collection of shareable ESLint configurations for Salesforce Commerce Cloud (SFCC) | ||
## Installation | ||
|
||
```sh | ||
$ yarn add @jenssimon/eslint-config-sfcc | ||
``` | ||
|
||
## General | ||
|
||
All configurations are based on the [Airbnb JavaScript Style Guide](https://github.com/airbnb/javascript#readme) and a set of additions ([@jenssimon/eslint-config-base](https://github.com/jenssimon/eslint-config-base#readme)). | ||
|
||
This package contains a recommended configuration and a configuration that matches the original ESLint configuration for the Storefront Reference Architecture (SFRA) with adjustments to validate with newer ESLint versions. | ||
|
||
## Configurations | ||
|
||
### Standard configuration | ||
|
||
This configuration is recommended for every custom cartridge. It is based on ([@jenssimon/eslint-config-base](https://github.com/jenssimon/eslint-config-base#readme)). | ||
|
||
```json | ||
{ | ||
"extends": [ | ||
"@jenssimon/sfcc" | ||
] | ||
} | ||
``` | ||
|
||
#### Standard confiuration (controllers) | ||
|
||
This is a configuration suitable for the `controllers` folder of a cartridge. The main reason is to add the rule of [eslint-plugin-sitegenesis](https://www.npmjs.com/package/eslint-plugin-sitegenesis). | ||
|
||
```json | ||
{ | ||
"extends": [ | ||
"@jenssimon/sfcc/controllers" | ||
] | ||
} | ||
``` | ||
|
||
### Configuration for SFRA | ||
|
||
This configuration matches the original ESLint configuration for the Storefront Reference Architecture (SFRA) with adjustments to validate with newer ESLint versions. | ||
It's only thought to be used with `app_storefront_base`. | ||
|
||
```json | ||
{ | ||
"extends": [ | ||
"@jenssimon/sfcc/sfra" | ||
] | ||
} | ||
``` | ||
|
||
There is also a configuration for client side JS that extends the configuration mentioned above. | ||
|
||
```json | ||
{ | ||
"extends": [ | ||
"@jenssimon/sfcc/sfra-storefront" | ||
] | ||
} | ||
``` | ||
|
||
## License | ||
|
||
MIT © 2019 [Jens Simon](https://github.com/jenssimon) | ||
|
||
[npm-url]: https://www.npmjs.com/package/@jenssimon/eslint-config-sfcc | ||
[npm-image]: https://badgen.net/npm/v/@jenssimon/eslint-config-sfcc | ||
[npm-downloads-image]: https://badgen.net/npm/dt/@jenssimon/eslint-config-sfcc | ||
|
||
[deps-url]: https://david-dm.org/jenssimon/eslint-config-sfcc | ||
[deps-image]: https://badgen.net/david/dep/jenssimon/eslint-config-sfcc | ||
|
||
[deps-dev-url]: https://david-dm.org/jenssimon/eslint-config-sfcc?type=dev | ||
[deps-dev-image]: https://badgen.net/david/dev/jenssimon/eslint-config-sfcc | ||
|
||
[deps-peer-url]: https://david-dm.org/jenssimon/eslint-config-sfcc?type=peer | ||
[deps-peer-image]: https://badgen.net/david/peer/jenssimon/eslint-config-sfcc | ||
|
||
[gh-url]: https://github.com/jenssimon/eslint-config-sfcc | ||
[gh-stars-image]: https://badgen.net/github/stars/jenssimon/eslint-config-sfcc | ||
[gh-forks-image]: https://badgen.net/github/forks/jenssimon/eslint-config-sfcc | ||
|
||
[codestyle-image]: https://badgen.net/badge/code%20style/airbnb/f2a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('./lib/controllers'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('./lib'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
plugins: ['sitegenesis'], | ||
rules: { | ||
'sitegenesis/no-global-require': ['error'], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
module.exports = { | ||
parser: 'babel-eslint', | ||
extends: [ | ||
'airbnb-base', | ||
'@jenssimon/base', | ||
], | ||
env: { | ||
commonjs: true, | ||
es6: true, | ||
browser: false, | ||
}, | ||
globals: { | ||
dw: true, | ||
customer: true, | ||
session: true, | ||
request: true, | ||
response: true, | ||
empty: true, | ||
PIPELET_ERROR: true, | ||
PIPELET_NEXT: true, | ||
global: true, | ||
webreferences: true, | ||
webreferences2: true, | ||
APIException: true, | ||
ConversionError: true, | ||
Fault: true, | ||
IOError: true, | ||
Iterator: true, | ||
QName: true, | ||
StopIteration: true, | ||
SystemError: true, | ||
XML: true, | ||
XMLList: true, | ||
XMLStreamError: true, | ||
}, | ||
rules: { | ||
'comma-dangle': ['error', 'always-multiline'], | ||
'consistent-return': 'off', | ||
'global-require': 'off', | ||
'import/no-unresolved': 'off', | ||
'import/no-extraneous-dependencies': 'off', | ||
'import/no-dynamic-require': 'off', | ||
'new-cap': 'off', | ||
'no-var': 'off', | ||
'no-restricted-globals': 'off', | ||
'object-shorthand': 'off', | ||
'prefer-arrow-callback': 'off', | ||
'prefer-const': 'off', | ||
'prefer-destructuring': 'off', | ||
'prefer-rest-params': 'off', | ||
'prefer-spread': 'off', | ||
'prefer-template': 'off', | ||
strict: 'off', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
module.exports = { | ||
extends: [ | ||
'airbnb-base/legacy', | ||
], | ||
rules: { | ||
'import/no-unresolved': 'off', | ||
indent: ['error', 4, { SwitchCase: 1, VariableDeclarator: 1 }], | ||
'func-names': 'off', | ||
'require-jsdoc': 'error', | ||
'valid-jsdoc': ['error', { | ||
preferType: { | ||
Boolean: 'boolean', Number: 'number', object: 'Object', String: 'string', | ||
}, | ||
requireReturn: false, | ||
}], | ||
'vars-on-top': 'off', | ||
'global-require': 'off', | ||
'no-shadow': ['error', { allow: ['err', 'callback'] }], | ||
|
||
// fix configuration for newer ESLint versions | ||
'linebreak-style': 'off', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.export = { | ||
rules: { | ||
'no-restricted-globals': 'off', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"name": "@jenssimon/eslint-config-sfcc", | ||
"version": "1.0.0", | ||
"description": "A collection of shareable ESLint configurations for Salesforce Commerce Cloud (SFCC)", | ||
"main": "index.js", | ||
"author": "Jens Simon <https://github.com/jenssimon>", | ||
"keywords": [ | ||
"eslint", | ||
"eslintconfig", | ||
"sfcc", | ||
"demandware", | ||
"salesforce", | ||
"commercecloud", | ||
"sfra" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/jenssimon/eslint-config-sfcc" | ||
}, | ||
"license": "MIT", | ||
"scripts": { | ||
"lint": "eslint --fix ./" | ||
}, | ||
"peerDependencies": { | ||
"@jenssimon/eslint-config-base": "^1.0.1", | ||
"babel-eslint": ">=10.0.1", | ||
"eslint": ">=5.13.0", | ||
"eslint-config-airbnb-base": ">=13.1.0", | ||
"eslint-plugin-sitegenesis": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"@jenssimon/eslint-config-base": "^1.0.1", | ||
"eslint": "^5.13.0", | ||
"eslint-config-airbnb-base": "^13.1.0", | ||
"eslint-plugin-eslint-comments": "^3.0.1", | ||
"eslint-plugin-import": "^2.16.0", | ||
"eslint-plugin-promise": "^4.0.1" | ||
}, | ||
"private": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('./lib/sfra/storefront'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.export = require('./lib/sfra'); |
Oops, something went wrong.