Skip to content
This repository has been archived by the owner on Aug 26, 2023. It is now read-only.

Commit

Permalink
Several improvements (#48)
Browse files Browse the repository at this point in the history
- Adding our usual editor config
- Adding linting for test files
- Adding prettier (and appliying it)
- Adding prettier to eslint
- Removing the license information from the PR template file (it's annoying to have this in github when opening a PR)
- Adjusting the workflow files to other projects
- Adding Jetbrains Copyright configuration
- Pinning dev dependencies
- Adding yarn berry
- Adding a yarn.lock so renovate can work

Signed-off-by: Tilman Vatteroth <[email protected]>
  • Loading branch information
mrdrogdrog authored Jul 2, 2022
1 parent e0c2a8c commit e8bd877
Show file tree
Hide file tree
Showing 38 changed files with 6,011 additions and 3,000 deletions.
470 changes: 470 additions & 0 deletions .editorconfig

Large diffs are not rendered by default.

22 changes: 0 additions & 22 deletions .eslintrc.js

This file was deleted.

36 changes: 36 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": [
"./tsconfig.json"
]
},
"plugins": [
"@typescript-eslint",
"jest",
"prettier"
],
"env": {
"jest": true,
"jest/globals": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"rules": {
"prettier/prettier": "error",
"jest/no-disabled-tests": "warn",
"jest/no-focused-tests": "error",
"jest/no-identical-title": "error",
"jest/prefer-to-have-length": "warn",
"jest/valid-expect": "error"
}
}
6 changes: 0 additions & 6 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
<!--
SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file)
SPDX-License-Identifier: CC-BY-SA-4.0
-->

### Description
This PR fixes/adds/improves/...

Expand Down
52 changes: 13 additions & 39 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
# SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
#
# SPDX-License-Identifier: AGPL-3.0-only

name: lint
name: Lint and check code style

on:
push:
branches: [main]
branches: [ main ]
pull_request:
branches: [main]
branches: [ main ]

jobs:
lint:
Expand All @@ -20,50 +20,24 @@ jobs:

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"

- name: Cache node_modules
uses: actions/cache@v3
- name: Cache yarn cache
uses: actions/cache@v3.0.4
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-16-yarn-${{ hashFiles('**/yarn.lock') }}
key: ${{ runner.os }}-18-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
${{ runner.os }}-yarn-18
- name: Set up NodeJS
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install dependencies
run: yarn install --frozen-lockfile --prefer-offline
- name: Lint code
run: yarn lint
format:
runs-on: ubuntu-latest
name: Checks codestyle of all .ts and .tsx files
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
node-version: 18

- name: Cache node_modules
uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-16-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Set up NodeJS
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install dependencies
run: yarn install --frozen-lockfile --prefer-offline
run: yarn install --immutable

- name: Lint code
run: yarn format
run: yarn lint
8 changes: 6 additions & 2 deletions .github/workflows/reuse.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# SPDX-FileCopyrightText: 2020 The HedgeDoc developers (see AUTHORS file)
# SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
#
# SPDX-License-Identifier: AGPL-3.0-only

name: REUSE Compliance Check

on: [push, pull_request]
on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
reuse:
Expand Down
18 changes: 12 additions & 6 deletions .github/workflows/main.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,30 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache node_modules

- name: Cache yarn cache
uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-16-yarn-${{ hashFiles('**/yarn.lock') }}
key: ${{ runner.os }}-18-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
${{ runner.os }}-yarn-18
- name: Set up NodeJS
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18

- name: Install dependencies
run: yarn install --frozen-lockfile --prefer-offline
run: yarn install --immutable

- name: Build project
run: yarn build
- name: Test project

- name: Test Project
run: yarn test
24 changes: 19 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
# SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
# SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
#
# SPDX-License-Identifier: CC0-1.0

npm-debug.log
.idea
node_modules
dist/
coverage/
lib/
lib/

# dependencies
/node_modules
/.pnp
.pnp.*

# package manager
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# IDE
.idea
!.idea/copyright
6 changes: 6 additions & 0 deletions .idea/copyright/hedgedoc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/copyright/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .npmignore.license
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)

SPDX-License-Identifier: CC0-1.0
SPDX-License-Identifier: CC0-1.0
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
4 changes: 4 additions & 0 deletions .prettierignore.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)

SPDX-License-Identifier: CC0-1.0

11 changes: 11 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"parser": "typescript",
"singleQuote": true,
"jsxSingleQuote": true,
"semi": false,
"tabWidth": 2,
"trailingComma": "none",
"bracketSpacing": true,
"bracketSameLine": true,
"arrowParens": "always"
}
3 changes: 3 additions & 0 deletions .prettierrc.json.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)

SPDX-License-Identifier: CC0-1.0
11 changes: 11 additions & 0 deletions .reuse/dep5
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,14 @@ Upstream-Name: html-to-react
Upstream-Contact: The HedgeDoc developers <[email protected]>
Source: https://github.com/hedgedoc/html-to-react

Files: .github/pull_request_template.md
Copyright: 2022 The HedgeDoc developers (see AUTHORS file)
License: CC-BY-SA-4.0

Files: .yarn/**
Copyright: Yarn contributors
License: LicenseRef-yarn

Files: .idea/**
Copyright: 2022 The HedgeDoc developers (see AUTHORS file)
License: CC0-1.0
786 changes: 786 additions & 0 deletions .yarn/releases/yarn-3.2.1.cjs

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
yarnPath: .yarn/releases/yarn-3.2.1.cjs
nodeLinker: node-modules

3 changes: 3 additions & 0 deletions .yarnrc.yml.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)

SPDX-License-Identifier: CC0-1.0
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!--
SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
SPDX-License-Identifier: CC-BY-SA-4.0
-->
Expand Down
26 changes: 26 additions & 0 deletions LICENSES/LicenseRef-yarn.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
BSD 2-Clause License

For Yarn software

Copyright (c) 2016-present, Yarn Contributors. All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!--
SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
SPDX-License-Identifier: CC-BY-SA-4.0
-->
Expand Down
14 changes: 14 additions & 0 deletions jest.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"transform": {
".(ts|tsx)": "ts-jest"
},
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx)$",
"testPathIgnorePatterns": [
"/dist/"
],
"moduleFileExtensions": [
"ts",
"tsx",
"js"
]
}
3 changes: 3 additions & 0 deletions jest.config.json.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)

SPDX-License-Identifier: CC0-1.0
Loading

0 comments on commit e8bd877

Please sign in to comment.