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

Megalinter #36

Closed
wants to merge 42 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
d857135
Default config of megalinter-javascript
lyricnz Jan 12, 2024
347670c
Start fixing markdown lint
lyricnz Jan 13, 2024
28a5206
Disable some things
lyricnz Jan 13, 2024
21dee38
Merge remote-tracking branch 'origin/develop' into feature/megalinter
lyricnz Jan 15, 2024
3068698
Merge branch 'develop' into feature/megalinter
lyricnz Jan 16, 2024
cceab3b
format
lyricnz Jan 16, 2024
bc32991
Remove Makefile - was deleted
lyricnz Jan 16, 2024
016f411
Merge branch 'develop' into feature/megalinter
lyricnz Jan 17, 2024
3d82d81
Enable typescript lint
lyricnz Jan 17, 2024
19b6166
Start tweaking
lyricnz Jan 17, 2024
46f68f3
Found secrets should not cause errors (for now)
lyricnz Jan 17, 2024
098f81b
format
lyricnz Jan 17, 2024
9524970
format
lyricnz Jan 17, 2024
5bc581d
All the Things
lyricnz Jan 17, 2024
ae486ac
Whitelist linters. Enable fixes
lyricnz Jan 17, 2024
2e91ba8
Merge branch 'develop' into feature/megalinter
lyricnz Jan 22, 2024
0372cc7
Linter fixes
lyricnz Jan 22, 2024
8ce4218
update workflow
lyricnz Jan 22, 2024
a5f43f9
VALIDATE_ALL_CODEBASE: true; use javascript flavour
lyricnz Jan 22, 2024
90afe70
Try fixing FILTER_REGEX_EXCLUDE
lyricnz Jan 23, 2024
1cfc607
Explicit config file for eslint in MegaLinter
lyricnz Jan 23, 2024
0cbf7d2
npm install eslint-import-resolver-typescript
lyricnz Jan 23, 2024
c3bd7ab
npm install eslint-import-resolver-typescript
lyricnz Jan 23, 2024
78ff1b4
Try npm-install
lyricnz Jan 23, 2024
b7dda74
TYPESCRIPT_ES_CLI_LINT_MODE: project
lyricnz Jan 23, 2024
92f0a33
Try different TYPESCRIPT_ES_PRE_COMMANDS
lyricnz Jan 24, 2024
dde1aa1
Trying random things...
lyricnz Jan 24, 2024
27d6666
Node 18
lyricnz Jan 24, 2024
5bd4c00
Install dev npm too
lyricnz Jan 24, 2024
e64369d
[MegaLinter] Apply linters fixes
lyricnz Jan 24, 2024
af91a99
Add AWS SDK v3 async paginator: paginateAwsV3()
simon-anz Jan 25, 2024
b7ac282
Convert all driver clients to new V3 style
lyricnz Jan 25, 2024
ef3b2a9
Convert config-loader to new client. Add explicit region <== FIXME
lyricnz Jan 25, 2024
c336790
Optimise imports. Rename paginateAwsV3 to paginateAwsCall.
simon-anz Jan 25, 2024
7e4076a
Minimise diffs
simon-anz Jan 25, 2024
2f69acb
Merge branch 'develop' into feature/megalinter
lyricnz Jan 25, 2024
8b296dc
Merge remote-tracking branch 'origin/develop' into feature/megalinter
lyricnz Jan 27, 2024
95ffea7
Merge branch 'develop' into feature/megalinter
lyricnz Jan 29, 2024
621706c
Merge branch 'develop' into feature/megalinter
simon-anz Feb 8, 2024
8cfe2f2
Fix a couple of links
simon-anz Feb 8, 2024
2db67d9
Fix links: section links should be #lower-case-title
simon-anz Feb 8, 2024
ba88e6c
[MegaLinter] Apply linters fixes
simon-anz Feb 8, 2024
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
16 changes: 16 additions & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"ignorePaths": [
"**/node_modules/**",
"**/vscode-extension/**",
"**/.git/**",
"**/.pnpm-lock.json",
".vscode",
"megalinter",
"package-lock.json",
"report"
],
"language": "en",
"noConfigSearch": true,
"words": ["megalinter", "oxsecurity", "powercycle", "powercycling"],
"version": "0.2"
}
12 changes: 6 additions & 6 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

version: 2
updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "/" # Location of package manifests
- package-ecosystem: 'npm' # See documentation for possible values
directory: '/' # Location of package manifests
schedule:
interval: "weekly"
interval: 'weekly'
ignore:
# For AWS SDK, ignore all patch updates for version updates only
- dependency-name: "aws-sdk"
update-types: ["version-update:semver-patch"]
# For AWS SDK, ignore all patch updates for version updates only
- dependency-name: 'aws-sdk'
update-types: ['version-update:semver-patch']
184 changes: 184 additions & 0 deletions .github/workflows/mega-linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
# MegaLinter GitHub Action configuration file
# More info at https://megalinter.io
---
name: MegaLinter

# Trigger mega-linter at every push. Action will also be visible from Pull
# Requests to main
on:
# Comment this line to trigger action only on pull-requests
# (not recommended if you don't pay for GH Actions)
push:

pull_request:
branches:
- main
- develop

# Comment env block if you do not want to apply fixes
env:
# Apply linter fixes configuration
#
# When active, APPLY_FIXES must also be defined as environment variable
# (in github/workflows/mega-linter.yml or other CI tool)
APPLY_FIXES: all

# Decide which event triggers application of fixes in a commit or a PR
# (pull_request, push, all)
APPLY_FIXES_EVENT: pull_request

# If APPLY_FIXES is used, defines if the fixes are directly committed (commit)
# or posted in a PR (pull_request)
APPLY_FIXES_MODE: commit

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true

jobs:
megalinter:
name: MegaLinter
runs-on: ubuntu-latest

# Give the default GITHUB_TOKEN write permission to commit and push, comment
# issues & post new PR; remove the ones you do not need
permissions:
contents: write
issues: write
pull-requests: write

steps:

# Git Checkout
- name: Checkout Code
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}

# If you use VALIDATE_ALL_CODEBASE = true, you can remove this line to
# improve performance
fetch-depth: 0

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18
cache: npm
# Install the npm dependencies
- name: Install packages for Node
run: npm install

# MegaLinter
- name: MegaLinter

# You can override MegaLinter flavor used to have faster performances
# More info at https://megalinter.io/flavors/
uses: oxsecurity/megalinter/flavors/[email protected]

id: ml

# All available variables are described in documentation
# https://megalinter.io/configuration/
env:

# Validates all source when push on main, else just the git diff with
# main. Override with true if you always want to lint all sources
#
# To validate the entire codebase, set to:
VALIDATE_ALL_CODEBASE: true
#
# To validate only diff with main, set to:
# VALIDATE_ALL_CODEBASE: >-
# ${{
# github.event_name == 'push' &&
# contains(fromJSON('["refs/heads/main", "refs/heads/develop"]'), github.ref)
# }}
# VALIDATE_ALL_CODEBASE: >-
# ${{
# github.event_name == 'push' &&
# contains(fromJSON('["refs/heads/main", "refs/heads/develop"]'), github.ref)
# }}

GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# ADD YOUR CUSTOM ENV VARIABLES HERE OR DEFINE THEM IN A FILE
# .mega-linter.yml AT THE ROOT OF YOUR REPOSITORY

# Uncomment to disable copy-paste and spell checks
# DISABLE: COPYPASTE,SPELL

# Upload MegaLinter artifacts
- name: Archive production artifacts
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: MegaLinter reports
path: |
megalinter-reports
mega-linter.log

# Set APPLY_FIXES_IF var for use in future steps
- name: Set APPLY_FIXES_IF var
run: |
printf 'APPLY_FIXES_IF=%s\n' "${{
steps.ml.outputs.has_updated_sources == 1 &&
(
env.APPLY_FIXES_EVENT == 'all' ||
env.APPLY_FIXES_EVENT == github.event_name
) &&
(
github.event_name == 'push' ||
github.event.pull_request.head.repo.full_name == github.repository
)
}}" >> "${GITHUB_ENV}"

# Set APPLY_FIXES_IF_* vars for use in future steps
- name: Set APPLY_FIXES_IF_* vars
run: |
printf 'APPLY_FIXES_IF_PR=%s\n' "${{
env.APPLY_FIXES_IF == 'true' &&
env.APPLY_FIXES_MODE == 'pull_request'
}}" >> "${GITHUB_ENV}"
printf 'APPLY_FIXES_IF_COMMIT=%s\n' "${{
env.APPLY_FIXES_IF == 'true' &&
env.APPLY_FIXES_MODE == 'commit' &&
(!contains(fromJSON('["refs/heads/main", "refs/heads/develop"]'), github.ref))
}}" >> "${GITHUB_ENV}"

# Create pull request if applicable
# (for now works only on PR from same repository, not from forks)
- name: Create Pull Request with applied fixes
uses: peter-evans/create-pull-request@v5
id: cpr
if: env.APPLY_FIXES_IF_PR == 'true'
with:
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
commit-message: "[MegaLinter] Apply linters automatic fixes"
title: "[MegaLinter] Apply linters automatic fixes"
labels: bot

- name: Create PR output
if: env.APPLY_FIXES_IF_PR == 'true'
run: |
echo "PR Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "PR URL - ${{ steps.cpr.outputs.pull-request-url }}"

# Push new commit if applicable
# (for now works only on PR from same repository, not from forks)
- name: Prepare commit
if: env.APPLY_FIXES_IF_COMMIT == 'true'
run: sudo chown -Rc $UID .git/

- name: Commit and push applied linter fixes
uses: stefanzweifel/git-auto-commit-action@v4
if: env.APPLY_FIXES_IF_COMMIT == 'true'
with:
branch: >-
${{
github.event.pull_request.head.ref ||
github.head_ref ||
github.ref
}}
commit_message: "[MegaLinter] Apply linters fixes"
commit_user_name: megalinter-bot
commit_user_email: [email protected]
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,7 @@ cdk.context.json
*.swp
.vscode

megalinter-reports/

# Resource file output
resources.json
42 changes: 42 additions & 0 deletions .mega-linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Configuration file for MegaLinter
#
# See all available variables at https://megalinter.io/latest/config-file/ and in
# linters documentation

# all, none, or list of linter keys
APPLY_FIXES: all

# If you use ENABLE variable, all other languages/formats/tooling-formats will
# be disabled by default
# ENABLE:

# If you use ENABLE_LINTERS variable, all other linters will be disabled by
# default
ENABLE_LINTERS:
- TYPESCRIPT_ES
- TYPESCRIPT_PRETTIER # doesn't run??
- MARKDOWN_MARKDOWN_LINK_CHECK
- MARKDOWN_MARKDOWN_TABLE_FORMATTER
- MARKDOWN_MARKDOWNLINT
- YAML_PRETTIER
- YAML_YAMLLINT

FILTER_REGEX_EXCLUDE: '(\.github/workflows)'

SHOW_ELAPSED_TIME: true

FILEIO_REPORTER: false
# Uncomment if you want MegaLinter to detect errors but not block CI to pass
# DISABLE_ERRORS: true

TYPESCRIPT_ES_CONFIG_FILE: .eslintrc.cjs
TYPESCRIPT_ES_CLI_LINT_MODE: project
TYPESCRIPT_ES_PRE_COMMANDS:
- command: 'pwd'
cwd: workspace
- command: 'ls -l'
cwd: workspace
- command: 'npm install --include dev'
cwd: workspace
- command: 'npm list --depth=0'
cwd: workspace
Loading
Loading