Skip to content

Commit

Permalink
chore: add linting policy
Browse files Browse the repository at this point in the history
  • Loading branch information
cdias900 committed May 6, 2024
1 parent 835a2ed commit 842fcfb
Show file tree
Hide file tree
Showing 53 changed files with 6,184 additions and 4,803 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
21 changes: 14 additions & 7 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@
"no-wildcard-postmessage",
"react"
],
"parser": "babel-eslint",
"parser": "@typescript-eslint/parser",
"extends": [
"standard",
"standard-react",
"plugin:prettier/recommended",
"prettier/standard",
"prettier/react",
"plugin:security/recommended"
"plugin:security/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/typescript"
],
"env" : {
"browser" : true,
Expand All @@ -36,7 +34,16 @@
"space-before-function-paren": 0,

"import/export": 0,
"indent": ["error", 4, { "ignoredNodes": ["ConditionalExpression"] }],
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_"
}
],
"@typescript-eslint/no-explicit-any": "warn",
/** ScanJS rules **/
"scanjs-rules/accidental_assignment": 1,
"scanjs-rules/assign_to_hostname" : 1,
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: CI
on:
push:
pull_request:
jobs:
ci:
if: ${{ contains(github.event.head_commit.message, '[run ci]') || github.event_name == 'pull_request' }}
runs-on: ubuntu-latest

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Saving cache
uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}

- name: Set up Node
uses: actions/setup-node@v1
with:
node-version: 18
registry-url: 'https://npm.pkg.github.com'

- name: Install dependencies
run: |
npm install
- name: Check linting
run: npm run lint

- name: Check TS
run: npm run check-ts

# - name: Check tests
# run: |
# npm run test
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged && npm run check-ts
9 changes: 9 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"bracketSameLine": true,
"bracketSpacing": true,
"singleQuote": true,
"trailingComma": "all",
"arrowParens": "avoid",
"semi": true,
"printWidth": 100
}
15 changes: 8 additions & 7 deletions karma-variables.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const process = {
env: {
APP_ID: 'IDmESP4jtv5BH15NTPdz8SGk',
BUILD_ENV: 'dev',
ENV: "partner",
STAGE: "stage",
TARGET_MODE: "targetMode",
}
env: {
APP_ID: 'IDmESP4jtv5BH15NTPdz8SGk',
BUILD_ENV: 'dev',
ENV: 'partner',
STAGE: 'stage',
TARGET_MODE: 'targetMode',
},
};
10 changes: 4 additions & 6 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable import/no-extraneous-dependencies */
const { createDefaultConfig } = require('@open-wc/testing-karma');
const merge = require('deepmerge');

Expand All @@ -16,8 +15,8 @@ module.exports = config => {
reporters: [
{ type: 'html', subdir: 'report-html' },
{ type: 'text', subdir: '.' },
{ type: 'lcov', subdir: '.' }
]
{ type: 'lcov', subdir: '.' },
],
},
plugins: [
// load plugin
Expand All @@ -41,9 +40,8 @@ module.exports = config => {
statements: 50,
branches: 30,
functions: 50,
lines: 50
}

lines: 50,
},
}),
);
return config;
Expand Down
Loading

0 comments on commit 842fcfb

Please sign in to comment.