Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

Commit

Permalink
add prettier and eslint packages (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vahor authored Aug 27, 2023
1 parent 58c9fd3 commit b35c14e
Show file tree
Hide file tree
Showing 11 changed files with 2,199 additions and 270 deletions.
6 changes: 6 additions & 0 deletions .changeset/sweet-badgers-brush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@pedaki/eslint-config": patch
"@pedaki/prettier-config": patch
---

add prettier and eslint packages
2 changes: 1 addition & 1 deletion .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
'todo':
'📦 packages':
- any:
- 'packages/**'
82 changes: 82 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: ["main"]
pull_request:
# The branches below must be a subset of the branches above
branches: ["main"]
schedule:
# Run at 19:26 UTC every Tuesday
- cron: "26 19 * * 2"

jobs:
analyze:
name: Analyze
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners
# Consider using larger runners for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: ["typescript"]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ]
# Use only 'java' to analyze code written in Java, Kotlin or both
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

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

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
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.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

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

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
15 changes: 12 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,23 @@
"npm": "use-pnpm"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"start": "dotenv -- turbo run start",
"format:check": "turbo run format:check",
"format": "turbo run format",
"clean": "turbo run clean",
"build": "dotenv -- turbo run build",
"test": "NODE_ENV=test dotenv -- turbo run test",
"dev": "dotenv -- turbo run dev",
"lint": "SKIP_ENV_VALIDATION=true && turbo run lint",
"typecheck": "turbo run typecheck"
},
"keywords": [
"pedaki"
],
"author": "Nathan David <me@vahor.fr>",
"license": "CC-BY-NC-SA-4.0",
"dependencies": {
"@changesets/cli": "^2.26.2"
"devDependencies": {
"@changesets/cli": "^2.26.2",
"turbo": "^1.10.13"
}
}
37 changes: 37 additions & 0 deletions packages/eslint-config/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
module.exports = {
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint", "import"],
env: {
browser: true,
node: true,
},
extends: [
"next",
"prettier",
"next/core-web-vitals",
"plugin:@typescript-eslint/recommended-type-checked",
"plugin:@typescript-eslint/stylistic-type-checked",
],
ignorePatterns: ["*.tsbuildinfo", "node_modules", "dist", "coverage"],
rules: {
"@next/next/no-html-link-for-pages": "off",
"@typescript-eslint/consistent-type-imports": [
"warn",
{
prefer: "type-imports",
fixStyle: "inline-type-imports",
},
],
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_" }],
"@typescript-eslint/ban-ts-comment": "warn",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-misused-promises": [
"error",
{ checksVoidReturn: false },
],
"import/consistent-type-specifier-style": ["error", "prefer-top-level"],
},
reportUnusedDisableDirectives: true,
};
15 changes: 15 additions & 0 deletions packages/eslint-config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "@pedaki/eslint-config",
"version": "1.0.0",
"main": "index.js",
"author": "Nathan David <me@vahor.fr>",
"license": "MIT",
"devDependencies": {
"@types/eslint": "^8.44.2",
"@typescript-eslint/eslint-plugin": "6.4.1",
"@typescript-eslint/parser": "6.4.1",
"eslint": "^8.47.0",
"eslint-config-next": "^13.4.19",
"eslint-config-prettier": "^9.0.0"
}
}
20 changes: 20 additions & 0 deletions packages/prettier-config/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/** @typedef {import("@ianvs/prettier-plugin-sort-imports").PluginConfig} SortImportsConfig*/
/** @typedef {import("prettier").Config} PrettierConfig*/
/** @typedef {{ tailwindConfig: string }} TailwindConfig*/

/** @type { PrettierConfig | SortImportsConfig | TailwindConfig } */
const config = {
plugins: [
require.resolve('@ianvs/prettier-plugin-sort-imports'),
require.resolve("prettier-plugin-tailwindcss")
],
semi: true,
trailingComma: "all",
singleQuote: true,
printWidth: 100,
tailwindConfig: './tailwind.config.cjs',
arrowParens: 'avoid',
tabWidth: 2,
};

module.exports = config;
13 changes: 13 additions & 0 deletions packages/prettier-config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "@pedaki/prettier-config",
"version": "0.0.0",
"main": "index.js",
"author": "Nathan David <me@vahor.fr>",
"license": "MIT",
"devDependencies": {
"prettier-plugin-tailwindcss": "^0.5.3",
"@types/prettier": "^2.7.3",
"prettier": "^3.0.2",
"@ianvs/prettier-plugin-sort-imports": "^4.1.0"
}
}
Loading

0 comments on commit b35c14e

Please sign in to comment.