Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add linting checks #1

Merged
merged 1 commit into from
Dec 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: [p-l-]
55 changes: 55 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# This file is part of IVRE.
# Copyright 2011 - 2022 Pierre LALET <pierre@droids-corp.org>
#
# IVRE is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# IVRE is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
# License for more details.
#
# You should have received a copy of the GNU General Public License
# along with IVRE. If not, see <http://www.gnu.org/licenses/>.

name: Linting tests

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
python-version: ['3.11']
node-version: ['19']

steps:

- name: Git checkout
uses: actions/checkout@v2

- name: Use Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Use Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- run: pip install codespell

- run: git ls-files | grep -vE '(^package-lock\.json|^doc/.*\.png)$' | xargs -r codespell

- run: npm install

- run: ./node_modules/prettier/bin-prettier.js --check main.ts

- run: ./node_modules/eslint/bin/eslint.js main.ts

- run: ./node_modules/typescript/bin/tsc -noEmit -skipLibCheck --target es2022 --moduleResolution node main.ts
5 changes: 4 additions & 1 deletion main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,11 @@ interface IvrePubkey {
}

interface IvreScript {
// @ts-ignore
id: string;
// @ts-ignore
output: string;
// @ts-ignore
"ssl-cert"?: IvreCertificate[];

[structured: string]: JSON;
Expand Down Expand Up @@ -145,7 +148,7 @@ function flag_emoji(country_code: string): string {
const codePoints = country_code
.toUpperCase()
.split("")
.map((char) => 127397 + char.charCodeAt());
.map((char) => 127397 + char.charCodeAt(0));
return String.fromCodePoint(...codePoints);
}
function tag_emoji(tag: IvreTag): string | undefined {
Expand Down