Skip to content

Commit

Permalink
Add Linting and Formatting to the codebase and add CI integration (#86)
Browse files Browse the repository at this point in the history
* Add eslint and prettier packages and their configs

* Lint and format codebase

* Add github actions to ensure successful builds and linting

* Update package.json

* Fix a bug when changing groups

* Lint and format codebase

* Update package-lock.json

Co-authored-by: Josh Holmer <[email protected]>
  • Loading branch information
nasirhemed and shssoichiro authored Jul 25, 2022
1 parent 8435fe6 commit 315d3f2
Show file tree
Hide file tree
Showing 20 changed files with 12,992 additions and 2,670 deletions.
34 changes: 34 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
module.exports = {
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
parserOptions: {
ecmaVersion: 2020, // Allows for the parsing of modern ECMAScript features
sourceType: 'module', // Allows for the use of imports
},
extends: [
'plugin:react/recommended', // Uses the recommended rules from @eslint-plugin-react
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
'plugin:prettier/recommended', // Enables eslint-plugin-prettier and eslint-config-prettier. This will display prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
'prettier', // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
],
rules: {
// Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
// e.g. "@typescript-eslint/explicit-function-return-type": "off",
'@typescript-eslint/no-this-alias': 0,
'react/jsx-key': 0,
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/no-unused-vars': 0,
'@typescript-eslint/explicit-module-boundary-types': 0,
'@typescript-eslint/ban-types': 0,
'prettier/prettier': [
'error',
{
endOfLine: 'auto',
},
],
},
settings: {
react: {
version: 'detect',
},
},
};
55 changes: 55 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Workflow to run on pull request and push to master

name: CI

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
pull_request:
branches: [ master ]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
node-version:
- 10
- 12
- 14
architecture:
- x64

name: Node ${{ matrix.node_version }} - ${{ matrix.os }}
steps:
- name: Checkout branch
uses: actions/checkout@v2

- name: Setup node
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node_version }}

- name: Install Packages
run: npm install

- name: Check linting
run: npm run check-lint

- name: It can build successfully
run: npm run build

- name: It can package into electron app
run: |
npm run package-darwin
npm run package-linux
npm run package-win32
7 changes: 7 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
semi: true,
trailingComma: "all",
singleQuote: true,
printWidth: 120,
tabWidth: 2
};
Loading

0 comments on commit 315d3f2

Please sign in to comment.