-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
4,646 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
root=true | ||
|
||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
|
||
[*.{mjs,cjs,js,mts,cts,ts,json,vue,html,scss,css,toml,md}] | ||
indent_style = tab | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
|
||
[*.{yml,yaml}] | ||
indent_style = space |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Setup | ||
description: Configure Node.js + pnpm and install dependencies | ||
|
||
inputs: | ||
registry: | ||
description: NPM registry to set up for auth | ||
required: false | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: package.json | ||
registry-url: ${{ inputs.registry }} | ||
|
||
- uses: pnpm/action-setup@v4 | ||
name: Setup pnpm | ||
id: pnpm-install | ||
with: | ||
run_install: false | ||
|
||
- name: Get pnpm cache dir | ||
id: pnpm-cache-dir | ||
shell: bash | ||
run: echo "pnpm-cache-dir=$(pnpm store path)" >> $GITHUB_OUTPUT | ||
|
||
- uses: actions/cache@v4 | ||
name: Setup pnpm cache | ||
with: | ||
path: ${{ steps.pnpm-cache-dir.outputs.pnpm-cache-dir }} | ||
key: | ||
${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pnpm-store- | ||
- name: Install dependencies | ||
shell: bash | ||
run: pnpm install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Check | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup env | ||
uses: ./.github/actions/setup | ||
|
||
- name: Run linter | ||
run: pnpm run lint | ||
|
||
typecheck: | ||
name: Typecheck | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup env | ||
uses: ./.github/actions/setup | ||
|
||
- name: Run typecheck | ||
run: pnpm run typecheck |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
name: Release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: SemVer for the release, for example "1.0.0" | ||
required: true | ||
type: string | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
check-version: | ||
name: Check Version | ||
runs-on: ubuntu-latest | ||
outputs: | ||
version: ${{ steps.version.outputs.release }} | ||
is-prerelease: ${{ steps.version.outputs.prerelease && true || false }} | ||
steps: | ||
- name: Check version | ||
uses: madhead/semver-utils@v4 | ||
id: version | ||
with: | ||
version: ${{ inputs.version }} | ||
lenient: false | ||
|
||
create-version: | ||
name: Create Version | ||
runs-on: ubuntu-latest | ||
needs: check-version | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup env | ||
uses: ./.github/actions/setup | ||
|
||
- name: Bump version | ||
run: pnpm version --no-git-tag-version '${{ needs.check-version.outputs.version }}' | ||
|
||
- name: Create version commit & tag | ||
run: | | ||
author='${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>' | ||
version='v${{ needs.check-version.outputs.version }}' | ||
branch='${{ github.ref }}' | ||
git config user.name 'github-actions[bot]' | ||
git config user.email '41898282+github-actions[bot]@users.noreply.github.com' | ||
git commit --all --author "$author" --message "$version" | ||
git tag --annotate "$version" --message "$version" | ||
git push --atomic origin "$branch" "$version" | ||
create-release: | ||
name: Create Release | ||
runs-on: ubuntu-latest | ||
needs: | ||
- check-version | ||
- create-version | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Create release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
gh release create \ | ||
'v${{ needs.check-version.outputs.version }}' \ | ||
--verify-tag \ | ||
--generate-notes \ | ||
${{ needs.check-version.outputs.is-prerelease == 'true' && '--prerelease' || '' }} | ||
publish-npm: | ||
name: Publish to NPM | ||
runs-on: ubuntu-latest | ||
needs: | ||
- check-version | ||
- create-version | ||
permissions: | ||
id-token: write | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: refs/tags/v${{ needs.check-version.outputs.version }} | ||
|
||
- name: Setup env | ||
uses: ./.github/actions/setup | ||
with: | ||
registry: https://registry.npmjs.org | ||
|
||
- name: Build | ||
run: pnpm run build | ||
|
||
- name: Publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
NPM_CONFIG_PROVENANCE: true | ||
run: | | ||
pnpm publish \ | ||
--access=public \ | ||
--no-git-checks \ | ||
--tag ${{ needs.check-version.outputs.is-prerelease == 'true' && 'canary' || 'latest' }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# User preferences | ||
.DS_Store | ||
|
||
# Dependencies | ||
node_modules/ | ||
|
||
# Builds / Caches | ||
dist/ | ||
coverage/ | ||
*.tsbuildinfo | ||
.eslintcache | ||
|
||
# IDEs / Editors | ||
.idea/ | ||
*.code-workspace | ||
.history/ | ||
*.sublime-settings | ||
.*.swp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
engine-strict=true | ||
shell-emulator=true | ||
save-prefix='' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"recommendations": ["dbaeumer.vscode-eslint", "editorconfig.editorconfig"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{ | ||
// Disable the default formatter, use eslint instead | ||
"prettier.enable": false, | ||
"editor.formatOnSave": false, | ||
|
||
// Auto fix | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll.eslint": "explicit", | ||
"source.organizeImports": "never" | ||
}, | ||
|
||
// Silent the stylistic rules in you IDE, but still auto fix them | ||
"eslint.rules.customizations": [ | ||
{ "rule": "style/*", "severity": "off", "fixable": true }, | ||
{ "rule": "format/*", "severity": "off", "fixable": true }, | ||
{ "rule": "*-indent", "severity": "off", "fixable": true }, | ||
{ "rule": "*-spacing", "severity": "off", "fixable": true }, | ||
{ "rule": "*-spaces", "severity": "off", "fixable": true }, | ||
{ "rule": "*-order", "severity": "off", "fixable": true }, | ||
{ "rule": "*-dangle", "severity": "off", "fixable": true }, | ||
{ "rule": "*-newline", "severity": "off", "fixable": true }, | ||
{ "rule": "*quotes", "severity": "off", "fixable": true }, | ||
{ "rule": "*semi", "severity": "off", "fixable": true } | ||
], | ||
|
||
// Enable eslint for all supported languages | ||
"eslint.validate": [ | ||
"javascript", | ||
"javascriptreact", | ||
"typescript", | ||
"typescriptreact", | ||
"vue", | ||
"html", | ||
"markdown", | ||
"json", | ||
"jsonc", | ||
"yaml", | ||
"toml", | ||
"xml", | ||
"gql", | ||
"graphql", | ||
"astro", | ||
"css", | ||
"less", | ||
"scss", | ||
"pcss", | ||
"postcss" | ||
], | ||
|
||
// Enable experimental support for TS config file | ||
"eslint.options": { | ||
"flags": ["unstable_ts_config"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import directusConfig from './src/index.js'; | ||
|
||
export default directusConfig(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Directus | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
{ | ||
"name": "@directus/eslint-config", | ||
"type": "module", | ||
"version": "0.0.0", | ||
"packageManager": "[email protected]", | ||
"description": "Shared ESLint config used in Directus projects", | ||
"author": { | ||
"name": "Monospace Inc", | ||
"email": "[email protected]", | ||
"url": "https://monospace.io" | ||
}, | ||
"license": "MIT", | ||
"funding": "https://github.com/directus/directus?sponsor=1", | ||
"homepage": "https://directus.io", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/directus/eslint-config.git" | ||
}, | ||
"exports": { | ||
".": "./dist/index.js", | ||
"./package.json": "./package.json" | ||
}, | ||
"files": [ | ||
"dist" | ||
], | ||
"engines": { | ||
"node": "18 || 20", | ||
"pnpm": "9" | ||
}, | ||
"maintainers": [ | ||
{ | ||
"name": "Pascal Jufer", | ||
"email": "[email protected]", | ||
"url": "https://github.com/paescuj" | ||
} | ||
], | ||
"scripts": { | ||
"build": "pnpm run '/^(bundle|typecheck)$/'", | ||
"bundle": "tsup src/index.ts --format=esm --dts --minify", | ||
"typecheck": "tsc --noEmit", | ||
"lint": "eslint --flag unstable_ts_config .", | ||
"inspect": "pnpm dlx @eslint/config-inspector --config eslint.config.ts" | ||
}, | ||
"peerDependencies": { | ||
"eslint": "^9.10" | ||
}, | ||
"dependencies": { | ||
"@antfu/eslint-config": "3.8.0", | ||
"eslint-flat-config-utils": "0.4.0", | ||
"eslint-plugin-format": "0.1.2", | ||
"prettier": "3.3.3" | ||
}, | ||
"devDependencies": { | ||
"@directus/tsconfig": "2.0.0", | ||
"eslint": "9.12.0", | ||
"jiti": "2.3.3", | ||
"tsup": "8.3.0", | ||
"typescript": "5.6.3" | ||
} | ||
} |
Oops, something went wrong.