Skip to content

Commit 24bac73

Browse files
authored
Merge pull request #13 from Countly/ar2rsawseen/main
Update publish workflow
2 parents a784443 + 3ef0110 commit 24bac73

24 files changed

+4444
-543
lines changed

.github/workflows/npm-publish.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
tags:
55
- '*'
66
workflow_dispatch:
7+
permissions:
8+
id-token: write # Required for OIDC
9+
contents: read
710
jobs:
811
publish:
912
runs-on: ubuntu-latest
@@ -15,11 +18,11 @@ jobs:
1518
with:
1619
node-version: '20'
1720
registry-url: 'https://registry.npmjs.org/'
21+
- name: Update npm
22+
run: npm install -g npm@latest
1823
- name: Install dependencies
1924
run: npm ci
2025
- name: Build
2126
run: npm run build
2227
- name: Publish to npm
2328
run: npm publish --access public
24-
env:
25-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/test.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,27 @@ on:
88
workflow_dispatch:
99

1010
jobs:
11+
lint:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v3
17+
18+
- name: Set up Node.js
19+
uses: actions/setup-node@v3
20+
with:
21+
node-version: '20'
22+
cache: 'npm'
23+
24+
- name: Install dependencies
25+
run: npm ci
26+
27+
- name: Run ESLint
28+
run: npm run lint
29+
30+
- name: Run TypeScript compiler check
31+
run: npm run build
1132
test:
1233
runs-on: ubuntu-latest
1334
steps:

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx lint-staged

.vscode/extensions.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"recommendations": [
3+
"dbaeumer.vscode-eslint",
4+
"esbenp.prettier-eslint"
5+
]
6+
}

.vscode/settings.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
// Enable ESLint
3+
"eslint.enable": true,
4+
// Validate these file types with ESLint
5+
"eslint.validate": [
6+
"javascript",
7+
"javascriptreact",
8+
"typescript",
9+
"typescriptreact"
10+
],
11+
// Format on save
12+
"editor.formatOnSave": true,
13+
// Use ESLint to fix issues on save
14+
"editor.codeActionsOnSave": {
15+
"source.fixAll.eslint": "explicit"
16+
},
17+
// Set default formatter for TypeScript files
18+
"[typescript]": {
19+
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
20+
},
21+
"[javascript]": {
22+
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
23+
},
24+
// Optional: Auto-save files
25+
"files.autoSave": "onFocusChange",
26+
// Show ESLint status in the status bar
27+
"eslint.alwaysShowStatus": true
28+
}

eslint.config.js

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import tseslint from '@typescript-eslint/eslint-plugin';
2+
import tsparser from '@typescript-eslint/parser';
3+
import importPlugin from 'eslint-plugin-import';
4+
5+
export default [
6+
{
7+
ignores: [
8+
'build/**',
9+
'node_modules/**',
10+
'coverage/**',
11+
'**/*.js',
12+
'**/*.d.ts',
13+
'dist/**',
14+
'tests/**',
15+
'*.config.ts',
16+
'*.config.js'
17+
]
18+
},
19+
{
20+
files: ['src/**/*.ts'],
21+
languageOptions: {
22+
parser: tsparser,
23+
parserOptions: {
24+
ecmaVersion: 2022,
25+
sourceType: 'module',
26+
project: './tsconfig.json'
27+
},
28+
globals: {
29+
console: 'readonly',
30+
process: 'readonly',
31+
Buffer: 'readonly',
32+
__dirname: 'readonly',
33+
__filename: 'readonly',
34+
module: 'readonly',
35+
require: 'readonly'
36+
}
37+
},
38+
plugins: {
39+
'@typescript-eslint': tseslint,
40+
'import': importPlugin
41+
},
42+
rules: {
43+
// TypeScript specific rules
44+
'@typescript-eslint/no-unused-vars': ['error', {
45+
argsIgnorePattern: '^_',
46+
varsIgnorePattern: '^_',
47+
destructuredArrayIgnorePattern: '^_'
48+
}],
49+
'@typescript-eslint/no-explicit-any': 'off', // Turned off for now - can be enabled gradually
50+
'@typescript-eslint/explicit-function-return-type': 'off',
51+
'@typescript-eslint/explicit-module-boundary-types': 'off',
52+
'@typescript-eslint/no-floating-promises': 'error',
53+
'@typescript-eslint/no-misused-promises': 'error',
54+
'@typescript-eslint/await-thenable': 'warn', // Downgraded to warning
55+
56+
// General rules
57+
'no-console': ['warn', { allow: ['warn', 'error'] }],
58+
'prefer-const': 'error',
59+
'no-var': 'error',
60+
'eqeqeq': ['error', 'always'],
61+
'curly': ['error', 'all'],
62+
'brace-style': ['error', '1tbs'],
63+
64+
// Import rules - relaxed
65+
'import/order': 'off', // Too strict for now
66+
'import/newline-after-import': 'off',
67+
'import/no-duplicates': 'error'
68+
}
69+
}
70+
];

0 commit comments

Comments
 (0)