-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CY-2720 - Final alignments for ESLint configuration (#38)
* Turned off security/detect-non-literal-require rule as it is duplicated by import/no-dynamic-require * Added eslint-common-node ESLint configuration * Added prettier-common Prettier configuration for all UI projects * Added env setup to common ESLint configs * Moved ESLint and Prettier configuration files to configs directory * Updated eslint* and prettier dependencies * Fixed source code and tests after prettier version upgrade * Aligned lint script in package.json files with other projects: * added --cache switch and added .eslintcache to .gitignore * added --ignore-path .gitignore * added --max-warnings 10 * Removed CircleCI from documentation and scripts * Fixed security issues by updating dependencies
- Loading branch information
Showing
16 changed files
with
12,115 additions
and
6,257 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 |
---|---|---|
@@ -1,17 +1,9 @@ | ||
{ | ||
"extends": [ | ||
"plugin:jsdoc/recommended", | ||
"./eslint/eslint-common.json" | ||
"./configs/eslint-common.json" | ||
], | ||
"rules": { | ||
"jsdoc/require-jsdoc": ["error"] | ||
}, | ||
"overrides": [ | ||
{ | ||
"files": "test/**/*.js", | ||
"env": { | ||
"jest": 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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.eslintcache | ||
.idea | ||
dist | ||
node_modules | ||
|
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('./configs/prettier-common.json'); |
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
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,38 @@ | ||
## Configurations | ||
|
||
This directory contains shared configuration for development tools. | ||
|
||
|
||
### ESLint | ||
|
||
ESLint configs should be extended by every cloudify-ui project/module. | ||
|
||
#### Usage | ||
|
||
Once `cloudify-ui-common` is installed as a dependency it is required to modify project's ESLint config (most probably `.eslintrc` or `.eslintrc.json` file) by adding the following entry (assuming ESLint config file is located in top level directory and it is a non-react project): | ||
```json | ||
{ | ||
"extends": ["./node_modules/cloudify-ui-common/configs/eslint-common.json"] | ||
} | ||
``` | ||
It is also required to install peer dependencies as specified in `package.json`. | ||
There are three configuration files that can be extended. | ||
The table below describes their purpose and dependencies necessary to be installed prior using each configuration file. | ||
|
||
| Configuration file | Used for | Dependencies | | ||
|--- |--- |---| | ||
| `eslint-common.json` | non-react common projects | `eslint`, `eslint-config-prettier`, `eslint-plugin-import`, `eslint-plugin-prettier`, `eslint-plugin-scanjs-rules`, `eslint-plugin-security` | | ||
| `eslint-common-react.json` | react-based projects | all from `eslint-common.json` and `eslint-plugin-react`, `eslint-plugin-react-hooks`, `eslint-plugin-jsx-a11y` | | ||
| `eslint-common-node.json` | node-based projects | all from `eslint-common.json`, `eslint-plugin-node` | | ||
|
||
|
||
### Prettier | ||
|
||
Prettier config should be extended by every cloudify-ui project/module. | ||
|
||
#### Usage | ||
|
||
Once `cloudify-ui-common` is installed as a dependency it is required to modify project's Prettier config (you should use JS version - `.prettierrc.js` file) by requiring common configuration the following way: | ||
```js | ||
module.exports = require('./node_modules/cloudify-ui-common/configs/prettier-common.json'); | ||
``` |
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,9 @@ | ||
{ | ||
"extends": [ | ||
"./eslint-common.json", | ||
"plugin:node/recommended" | ||
], | ||
"env": { | ||
"node": 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 |
---|---|---|
|
@@ -12,5 +12,8 @@ | |
"props": false | ||
} | ||
] | ||
}, | ||
"env": { | ||
"browser": 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
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
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -15,7 +15,7 @@ pipeline { | |
yamlFile 'jenkins/build-pod.yaml' | ||
} | ||
} | ||
|
||
environment { | ||
MAIN_BRANCH = 'master' | ||
WORKSPACE = "${env.WORKSPACE}" | ||
|
@@ -36,7 +36,7 @@ pipeline { | |
dir("${env.WORKSPACE}/${env.PROJECT}") { | ||
echo "Install dependencies" | ||
sh 'npm ci --prefer-offline' | ||
|
||
echo "Build application" | ||
sh 'npm run build' | ||
|
||
|
@@ -65,14 +65,14 @@ pipeline { | |
withVault([configuration: configuration, vaultSecrets: secrets]) { | ||
echo "Authenticate with registry" | ||
sh "echo '//registry.npmjs.org/:_authToken=${env.NPM_TOKEN}' > .npmrc" | ||
|
||
echo "Publish package" | ||
sh 'npm publish' | ||
|
||
echo "Setup git user" | ||
sh ''' | ||
git config user.email "[email protected]" | ||
git config user.name "cosmo-admin-CircleCI" | ||
git config user.name "cosmo-admin-Jenkins" | ||
''' | ||
|
||
echo "Update main branch" | ||
|
@@ -105,4 +105,4 @@ pipeline { | |
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.