add linting workflows

This commit is contained in:
wieerwill 2023-12-06 20:39:05 +01:00
parent d5daf0de99
commit fa1bb19623
8 changed files with 1824 additions and 0 deletions

2
.eslintignore Normal file
View File

@ -0,0 +1,2 @@
node_modules
dist

34
.eslintrc.js Normal file
View File

@ -0,0 +1,34 @@
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 2020,
sourceType: "module",
ecmaFeatures: {
jsx: true,
},
// project: "./tsconfig.json",
},
settings: {
react: {
version: "detect",
},
},
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
// Add more specific rules if needed
],
rules: {
// Add custom rules or override existing ones here
},
overrides: [
{
files: ["*.js"],
rules: {
"@typescript-eslint/no-var-requires": "off",
// Additional JavaScript specific rules
},
},
],
};

3
.flake8 Normal file
View File

@ -0,0 +1,3 @@
[flake8]
max-line-length = 120
exclude = .git,__pycache__,old,build,dist

61
.github/workflows/lint.yml vendored Normal file
View File

@ -0,0 +1,61 @@
name: Lint Code Base
on: [push, pull_request]
jobs:
build:
name: Lint
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
# Checkout the repository
- name: Checkout Repository
uses: actions/checkout@v2
# Setup Python
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
# Lint Python files
- name: Lint Python
run: |
pip install flake8
# Stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# Exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
# Setup Node.js for JavaScript and TypeScript
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14'
# Lint JavaScript files
- name: Lint JavaScript
run: |
npm install
npm run lint
# Lint TypeScript files
- name: Lint TypeScript
run: |
npm install
npm run lint
# Setup Rust
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
# Lint Rust files
- name: Lint Rust
run: |
cd Day*/rust
cargo clippy -- -D warnings

131
.gitignore vendored
View File

@ -207,6 +207,137 @@ Cargo.lock
*.out
*.app
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional stylelint cache
.stylelintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
out
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# vuepress v2.x temp and cache directory
.temp
.cache
# Docusaurus cache and generated files
.docusaurus
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
solution
helper.md
*/input.txt

1563
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

19
package.json Normal file
View File

@ -0,0 +1,19 @@
{
"name": "adventofcode2023",
"version": "1.0.0",
"description": "Welcome to my repository where I share my solutions for the [Advent of Code 2023](https://adventofcode.com/2023). Advent of Code is an annual online event where participants solve a series of programming puzzles released daily from December 1st until December 25th. Each puzzle is a fun and unique challenge designed to test problem-solving skills.",
"main": "index.js",
"scripts": {
"lint": "eslint 'Day**/{js,ts}/*.{js,ts}'",
"lint:fix": "eslint 'Day**/{js,ts}/*.{js,ts}' --fix",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^6.13.2",
"@typescript-eslint/parser": "^6.13.2",
"eslint": "^8.55.0"
}
}

11
tsconfig.json Normal file
View File

@ -0,0 +1,11 @@
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"strict": true,
"esModuleInterop": true
},
"include": [
"Day**/{js,ts}/*.ts"
]
}