Skip to content

Commit

Permalink
chore: add more eslint rules (#24)
Browse files Browse the repository at this point in the history
* chore: enforce `node:` protocol
* chore: enable type-aware rules
  • Loading branch information
AriPerkkio committed Jul 28, 2023
1 parent 297390c commit a827d95
Show file tree
Hide file tree
Showing 5 changed files with 345 additions and 22 deletions.
14 changes: 14 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,15 @@ module.exports = {
ecmaVersion: 2020,
sourceType: 'module',
},
plugins: ['unicorn'],
extends: [
'eslint:recommended',
'plugin:prettier/recommended',
'plugin:astro/recommended',
],
rules: {
'unicorn/prefer-node-protocol': 'error',
},
overrides: [
{
files: ['*.astro'],
Expand All @@ -24,6 +28,16 @@ module.exports = {
extraFileExtensions: ['.astro'],
},
},
{
files: ['./packages/**/*.ts'],
excludedFiles: ['**/*.d.ts'],
parserOptions: {
project: ['./packages/*/tsconfig.json'],
},
extends: [
'plugin:@typescript-eslint/recommended-requiring-type-checking',
],
},
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
};
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@
},
"devDependencies": {
"@types/node": "^20.4.4",
"@typescript-eslint/eslint-plugin": "^6.2.0",
"@typescript-eslint/parser": "^6.1.0",
"eslint": "^8.45.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-astro": "^0.27.2",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-unicorn": "^48.0.1",
"prettier": "^3.0.0",
"prettier-plugin-astro": "^0.11.0",
"typescript": "^5.1.6"
Expand Down
4 changes: 2 additions & 2 deletions packages/actions-new-meetup/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { context, getOctokit } from '@actions/github';
import format from 'date-fns/format';
import isValid from 'date-fns/isValid';
import parse from 'date-fns/parse';
import fs from 'fs/promises';
import fs from 'node:fs/promises';
import { z } from 'zod';

const envSchema = z.object({
Expand Down Expand Up @@ -143,7 +143,7 @@ async function main() {
core.info('Done');
}

main();
void main();

function sanitizeString(str: string) {
return str.replace(/[^a-z0-9]/gi, '-').toLowerCase();
Expand Down
4 changes: 2 additions & 2 deletions packages/actions-post-create-pr/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ Hi there! Thanks for creating a new meetup. I'm going to create a new branch and
1. Validating meetup details... Done! ✅
2. Creating meetup file... Done! ✅
3. Creating new branch and pull request... Done! ✅
3. Creating new branch and pull request... Done! ✅
Here's the new pull request: #${env.PULL_REQUEST_NUMBER}`,
});
}

main();
void main();
Loading

0 comments on commit a827d95

Please sign in to comment.