Skip to content

Commit

Permalink
visualization: Add CI
Browse files Browse the repository at this point in the history
  • Loading branch information
eigendude committed Mar 8, 2024
1 parent f0b9e7d commit 3e01f85
Show file tree
Hide file tree
Showing 7 changed files with 771 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Prettier Code Formatter

# Controls when the action will run. Triggers the workflow on push or pull
# request events
on: [push, pull_request]

jobs:
prettier:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
node_version: 20

steps:
- name: Check out code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '${{ matrix.node_version }}'

- name: Cache pnpm modules
id: cache-pnpm-modules
uses: actions/cache@v4
with:
path: oasis_visualization/node_modules
key: ${{ runner.os }}-${{ matrix.node_version }}-pnpm-${{ hashFiles('oasis_visualization/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-${{ matrix.node_version }}-pnpm-
- name: Install pnpm
run: npm install -g pnpm

- name: Install dependencies
if: steps.cache-pnpm-modules.outputs.cache-hit != 'true'
run: pnpm install
working-directory: oasis_visualization

- name: Run linter
run: pnpm lint
working-directory: oasis_visualization
39 changes: 39 additions & 0 deletions oasis_visualization/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright (C) 2024 Garrett Brown
* This file is part of OASIS - https://github.com/eigendude/OASIS
*
* SPDX-License-Identifier: Apache-2.0
* See the file LICENSE.txt for more information.
*/

module.exports = {
env: {
browser: true,
es2021: true,
},
extends: "eslint:recommended",
globals: {
imports: "readonly",
},
overrides: [
{
env: {
node: true,
},
files: [".eslintrc.{js,cjs}"],
parserOptions: {
sourceType: "script",
},
},
],
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
rules: {
indent: ["error", 2],
"linebreak-style": ["error", "unix"],
quotes: ["error", "double"],
semi: ["error", "always"],
},
};
1 change: 1 addition & 0 deletions oasis_visualization/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/node_modules
2 changes: 2 additions & 0 deletions oasis_visualization/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/node_modules
/pnpm-lock.yaml
3 changes: 3 additions & 0 deletions oasis_visualization/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"tabWidth": 2
}
11 changes: 11 additions & 0 deletions oasis_visualization/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "oasis-visualization",
"scripts": {
"format": "prettier --write . && eslint . --ext .js --fix",
"lint": "prettier --check . && eslint . --ext .js"
},
"devDependencies": {
"eslint": "^8.57.0",
"prettier": "^3.2.5"
}
}
Loading

0 comments on commit 3e01f85

Please sign in to comment.