Skip to content

Commit

Permalink
lint setup
Browse files Browse the repository at this point in the history
  • Loading branch information
neSpecc committed Nov 9, 2024
1 parent 0d4c78e commit f0dfa66
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 39 deletions.
56 changes: 26 additions & 30 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: CI
on: push

jobs:
lint-test-build-publish:
lint-test-build:
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
Expand All @@ -12,19 +12,15 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 14
node-version: 20
registry-url: 'https://registry.npmjs.org'
scope: '@codexteam'

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Restore Yarn cache
uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
path: .yarn/cache
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
Expand All @@ -33,36 +29,36 @@ jobs:
run: yarn install

- name: Test Eslint
run: yarn lint:test
run: yarn lint

- name: Run unit tests
run: yarn test

- name: Build library
run: yarn build

- name: Publish library
if: ${{ github.ref == 'refs/heads/main' }}
run: yarn publish --access=public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# - name: Publish library
# if: ${{ github.ref == 'refs/heads/main' }}
# run: yarn publish --access=public
# env:
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

notify:
needs: lint-test-build-publish
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v2
# notify:
# needs: lint-test-build-publish
# if: github.ref == 'refs/heads/main'
# runs-on: ubuntu-20.04
# steps:
# - name: Checkout repository
# uses: actions/checkout@v2

- name: Get package info
id: package
uses: codex-team/action-nodejs-package-info@v1
# - name: Get package info
# id: package
# uses: codex-team/action-nodejs-package-info@v1

- name: Send a message
uses: codex-team/action-codexbot-notify@v1
with:
webhook: ${{ secrets.CODEX_BOT_WEBHOOK }}
message: '📦 [${{ steps.package.outputs.name }}](${{ steps.package.outputs.npmjs-link }}) ${{ steps.package.outputs.version }} was published'
parse_mode: 'markdown'
disable_web_page_preview: true
# - name: Send a message
# uses: codex-team/action-codexbot-notify@v1
# with:
# webhook: ${{ secrets.CODEX_BOT_WEBHOOK }}
# message: '📦 [${{ steps.package.outputs.name }}](${{ steps.package.outputs.npmjs-link }}) ${{ steps.package.outputs.version }} was published'
# parse_mode: 'markdown'
# disable_web_page_preview: true
7 changes: 6 additions & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import CodeX from 'eslint-config-codex';
import { plugin as TsPlugin, parser as TsParser } from 'typescript-eslint';
import path from 'path';
import { fileURLToPath } from 'url';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

export default [
...CodeX,
Expand All @@ -18,7 +23,7 @@ export default [
languageOptions: {
parser: TsParser,
parserOptions: {
project: './tsconfig.eslint.json',
project: path.resolve(__dirname, 'tsconfig.json'),
tsconfigRootDir: './',
sourceType: 'module',
},
Expand Down
1 change: 1 addition & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"mylib-utils": "workspace:^"
},
"devDependencies": {
"eslint": "^9.14.0",
"rimraf": "^6.0.1",
"typescript": "^5.6.3"
}
Expand Down
1 change: 1 addition & 0 deletions packages/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"test": "jest"
},
"devDependencies": {
"eslint": "^9.14.0",
"typescript": "^5.6.3"
}
}
8 changes: 0 additions & 8 deletions tsconfig.eslint.json

This file was deleted.

2 changes: 2 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4394,6 +4394,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "mylib-utils@workspace:packages/utils"
dependencies:
eslint: "npm:^9.14.0"
typescript: "npm:^5.6.3"
languageName: unknown
linkType: soft
Expand All @@ -4402,6 +4403,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "mylib@workspace:packages/core"
dependencies:
eslint: "npm:^9.14.0"
mylib-utils: "workspace:^"
rimraf: "npm:^6.0.1"
typescript: "npm:^5.6.3"
Expand Down

0 comments on commit f0dfa66

Please sign in to comment.