Skip to content

Commit

Permalink
build: simplify eslint and introduce prettier (sbb-design-systems#417)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyubisation authored Jun 17, 2022
1 parent d98ff18 commit dbae2d6
Show file tree
Hide file tree
Showing 60 changed files with 1,091 additions and 1,098 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
dist/**/*

# not ignored folders/files
!.travis.yml
!.github
12 changes: 0 additions & 12 deletions .eslintrc.js

This file was deleted.

12 changes: 12 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"root": true,
"env": {
"es2020": true,
"node": true
},
"extends": ["eslint:recommended", "prettier"],
"parserOptions": {
"ecmaVersion": 2020
},
"plugins": ["yaml"]
}
7 changes: 4 additions & 3 deletions .github/SECURITY.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Security Policy

**PLEASE DON'T DISCLOSE SECURITY-RELATED ISSUES PUBLICLY, [SEE BELOW](#reporting-a-vulnerability--security-issue).**
**PLEASE DON'T DISCLOSE SECURITY-RELATED ISSUES PUBLICLY, [SEE BELOW](#reporting-a-vulnerability--security-issue).**

## Supported Versions

Expand All @@ -10,11 +10,12 @@ Only the latest major version receives security fixes.

Let’s keep things simple –

The *Lyne* team takes all security concerns in *Lyne Design System* seriously. Thank you for improving the security of *Lyne*. We appreciate your efforts, responsible disclosure your information and will make every effort to acknowledge your contributions.
The _Lyne_ team takes all security concerns in _Lyne Design System_ seriously. Thank you for improving the security of _Lyne_. We appreciate your efforts, responsible disclosure your information and will make every effort to acknowledge your contributions.

If you think you have identified a vulnerability or security related issue within *Lyne Design System*, please report it immediately to [email protected]. If you are not sure, don’t worry. Better safe than sorry – just send an email.
If you think you have identified a vulnerability or security related issue within _Lyne Design System_, please report it immediately to [email protected]. If you are not sure, don’t worry. Better safe than sorry – just send an email.

**Please do not:**

- Open issues on GitHub related to any security concerns **publicly**
- Include **anyone else** on the disclosure email

Expand Down
68 changes: 34 additions & 34 deletions .github/actions/download-artifacts-from-workflow/action.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
name: "Download artifacts from another workflow"
description: "Download artifacts from another workflow"
name: 'Download artifacts from another workflow'
description: 'Download artifacts from another workflow'

inputs:
artifacts: # id of input
artifacts: # id of input
description: 'Comma-separated list of downloadable artifacts'
required: true

runs:
using: "composite"
using: 'composite'
steps:
- name: 'Download artifacts'
uses: actions/github-script@v6
with:
script: |
const fs = require('fs');
const artifacts = '${{ inputs.artifacts }}'.trim().split(/[, ]+/);
console.log(`Attempting to download artifacts ${artifacts.join(', ')}`);
const workflowArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
});
for (const artifact of artifacts) {
const matchArtifact = workflowArtifacts.data.artifacts
.find((a) => a.name == artifact);
if (matchArtifact) {
console.log(`Found artifact ${artifact}`);
const download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
const artifactPath = `${process.env.GITHUB_WORKSPACE}/${artifact}.zip`;
fs.writeFileSync(artifactPath, Buffer.from(download.data));
console.log(`Downloaded artifact to ${artifactPath}`);
} else {
const availableArtifacts = workflowArtifacts.data.artifacts.map((a) => a.name);
console.log(`Unable to find artifact ${artifact} (Available: ${availableArtifacts.join(', ')})`);
}
- name: 'Download artifacts'
uses: actions/github-script@v6
with:
script: |
const fs = require('fs');
const artifacts = '${{ inputs.artifacts }}'.trim().split(/[, ]+/);
console.log(`Attempting to download artifacts ${artifacts.join(', ')}`);
const workflowArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
});
for (const artifact of artifacts) {
const matchArtifact = workflowArtifacts.data.artifacts
.find((a) => a.name == artifact);
if (matchArtifact) {
console.log(`Found artifact ${artifact}`);
const download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
const artifactPath = `${process.env.GITHUB_WORKSPACE}/${artifact}.zip`;
fs.writeFileSync(artifactPath, Buffer.from(download.data));
console.log(`Downloaded artifact to ${artifactPath}`);
} else {
const availableArtifacts = workflowArtifacts.data.artifacts.map((a) => a.name);
console.log(`Unable to find artifact ${artifact} (Available: ${availableArtifacts.join(', ')})`);
}
}
14 changes: 7 additions & 7 deletions .github/actions/yarn-install/action.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: "Installing Yarn dependencies"
description: "Installs the dependencies using Yarn"
name: 'Installing Yarn dependencies'
description: 'Installs the dependencies using Yarn'

runs:
using: "composite"
steps:
- name: "Yarn: Get cache directory path"
using: 'composite'
steps:
- name: 'Yarn: Get cache directory path'
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
shell: bash
- name: "Yarn: Restore dependencies from cache"
- name: 'Yarn: Restore dependencies from cache'
uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
Expand All @@ -17,6 +17,6 @@ runs:
# See: https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows#example-using-the-cache-action.
key: ${{ runner.os }}-yarn-v1-${{hashFiles('yarn.lock')}}
restore-keys: ${{ runner.os }}-yarn-v1-
- name: "Yarn: Install dependencies"
- name: 'Yarn: Install dependencies'
run: yarn install --frozen-lockfile --non-interactive
shell: bash
16 changes: 8 additions & 8 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: "weekly"
day: "sunday"
time: "01:00"
timezone: "Europe/Berlin"
open-pull-requests-limit: 20
- package-ecosystem: npm
directory: '/'
schedule:
interval: 'weekly'
day: 'sunday'
time: '01:00'
timezone: 'Europe/Berlin'
open-pull-requests-limit: 20
58 changes: 29 additions & 29 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
name: 'CodeQL'

on:
push:
branches: [ master ]
branches: [master]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
branches: [master]
schedule:
- cron: '43 16 * * 2'

Expand All @@ -32,40 +32,40 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
language: ['javascript']
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

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

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release
#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
43 changes: 21 additions & 22 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,31 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14
- name: Yarn Install
uses: ./.github/actions/yarn-install
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14
- name: Yarn Install
uses: ./.github/actions/yarn-install

- name: Run eslint
run: yarn lint
- name: Run eslint
run: yarn lint

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14
- name: Yarn Install
uses: ./.github/actions/yarn-install

- name: Run build
run: yarn build
- name: Store storybook artifacts
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14
- name: Yarn Install
uses: ./.github/actions/yarn-install

- name: Run build
run: yarn build
- name: Store storybook artifacts
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/
# TODO: Trigger lyne-documentation build (node ./ci/trigger_lyne_documentation.js)
3 changes: 1 addition & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: Release
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
on:
workflow_run:
workflows: ["Continuous Integration"]
workflows: ['Continuous Integration']
types: [completed]
branches: [master]

Expand Down Expand Up @@ -39,7 +39,6 @@ jobs:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


- name: Install netlify CLI
run: yarn global add netlify-cli
- name: Deploy CDN assets
Expand Down
2 changes: 1 addition & 1 deletion .husky/commit-msg
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

. "$(dirname "$0")/_/husky.sh"

npx --no-install commitlint --edit $1
yarn commitlint --edit $1
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"

yarn lint-staged
2 changes: 1 addition & 1 deletion .releaserc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
["@semantic-release/git", {
"assets": [
"package.json",
"package-lock.json",
"yarn.lock",
"CHANGELOG.md",
"properties/**/*.json"
],
Expand Down
Loading

0 comments on commit dbae2d6

Please sign in to comment.