Create basic config

This commit is contained in:
RubenPX 2022-04-20 11:54:58 +02:00
parent 154362613e
commit e68471d307
5 changed files with 132 additions and 0 deletions

4
.eslintignore Normal file
View File

@ -0,0 +1,4 @@
ereuse_devicehub/static/vendor
ereuse_devicehub/static/js/print.pdf.js
ereuse_devicehub/static/js/qrcode.js
*.min.js

36
.eslintrc.json Normal file
View File

@ -0,0 +1,36 @@
{
"env": {
"browser": true,
"es2021": true,
"jquery": true
},
"extends": [
"airbnb",
"prettier"
],
"plugins": [
"prettier"
],
"parserOptions": {
"ecmaVersion": "latest"
},
"rules": {
"quotes": ["error","double"],
"no-use-before-define": "off",
"no-unused-vars": "warn",
"no-undef": "warn",
"camelcase": "off",
"no-console": "off",
"no-plusplus": "off",
"no-param-reassign": "off",
"no-new": "warn",
"strict": "off",
"class-methods-use-this": "off",
"eqeqeq": "warn",
"radix": "warn"
},
"globals": {
"API_URLS": true,
"Api": true
}
}

54
.github/workflows/eslint.yml vendored Normal file
View File

@ -0,0 +1,54 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# ESLint is a tool for identifying and reporting on patterns
# found in ECMAScript/JavaScript code.
# More details at https://github.com/eslint/eslint
# and https://eslint.org
name: ESLint
on:
push:
branches: [master, testing]
pull_request:
branches: [master, testing]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '16'
- name: Install dependencies
run: npm install
- name: Save Code Linting Report JSON
# npm script for ESLint
# eslint --output-file eslint_report.json --format json src
# See https://eslint.org/docs/user-guide/command-line-interface#options
run: npm run lint:report
# Continue to the next step even if this fails
continue-on-error: true
- name: Annotate Code Linting Results
uses: ataylorme/eslint-annotate-action@1.2.0
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
report-json: "eslint_report.json"
- name: Run linters
uses: wearerequired/lint-action@v1
with:
eslint: true
prettier: false
commit_message: "Fix code style issues with ${linter}"
auto_fix: true
commit: true
github_token: "${{ secrets.GITHUB_TOKEN }}"
git_name: "Lint Action"
- name: Upload ESLint report
uses: actions/upload-artifact@v2
with:
name: eslint_report.json
path: eslint_report.json

8
.gitignore vendored
View File

@ -119,3 +119,11 @@ ENV/
# Temporal dir # Temporal dir
tmp/ tmp/
# NPM modules
node_modules/
yarn.lock
# ESLint Report
eslint_report.json

30
package.json Normal file
View File

@ -0,0 +1,30 @@
{
"name": "workspace",
"version": "1.0.0",
"description": "Devicehub is a distributed IT Asset Management System focused in reusing devices, created under the project [eReuse.org](https://www.ereuse.org)",
"main": "index.js",
"directories": {
"doc": "docs",
"example": "examples",
"test": "tests"
},
"devDependencies": {
"eslint": "^8.13.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-prettier": "^4.0.0"
},
"scripts": {
"lint:report": "eslint ereuse_devicehub --ext .js --output-file eslint_report.json --format json",
"lint:fix": "eslint ereuse_devicehub --ext .js --fix"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-react": "^7.29.4",
"eslint-plugin-react-hooks": "^4.4.0"
}
}