Skip to content

Commit

Permalink
️️⚡️ BUMP ⚡️ 6 files 58(+) 110(-)
Browse files Browse the repository at this point in the history
  • Loading branch information
borestad committed Feb 8, 2024
1 parent d971b45 commit 2809092
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 110 deletions.
5 changes: 5 additions & 0 deletions .cron/deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 12 additions & 3 deletions .cron/jobs/example1.job.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#!/usr/bin/env -S deno run -A

import { Code, benchmark, bkt, hr, log, root } from 'util.ts'
import { Code, benchmark, bkt, hr, log, root, wc } from 'util.ts'
import { $ } from 'deps.ts'

const b = benchmark(1000)
const b1 = benchmark()
const b2 = benchmark(1000)

await $`echo hello world`
const param = '+%Y-%m-%d-%H%M%S'
Expand All @@ -28,4 +29,12 @@ log(Code.OK)
log(Code.ERROR)
log(Code.WARN)

log(b())
log(b1())
log(b2())

$.cd(root)
log('Lines:', await wc('.cron/jobs/example1.job.ts'))

// Disable on purpose to test working no-floating-promises
// eslint-disable-next-line ts/no-floating-promises
wc('.cron/jobs/example1.job.ts')
15 changes: 9 additions & 6 deletions .cron/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,22 @@
"rootDir": ".",
"module": "NodeNext",
"moduleResolution": "nodenext",
"checkJs": true,
"strict": true,
"checkJs": false,
"strict": false,
"noImplicitAny": false,
"outDir": "./dist",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true
},
"files": [
// "./jobs/example1.ts",
// "./jobs/example2.ts",
// "./.cron/jobs/example1.job.ts",
// "./.cron/jobs/example2.job.ts",
// "./.cron/*.ts",
// "./.cron/**/*.ts"
],
"include": [
"**/*.ts"
// ".*/**/*.ts"
"**/*.ts",
".cron/**/*.ts"
],
"exclude": [
"deno.json"
Expand Down
8 changes: 6 additions & 2 deletions .cron/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,13 @@ export const Code = {
/**
* Benchmark helper
*/
export function benchmark(unit = 1) {
export function benchmark(unitMs = 1) {
const start = performance.now()
return (now = performance.now()) => {
return ((now - start) / unit).toFixed(2)
return ((now - start) / unitMs).toFixed(2)
}
}

export function wc(path: string): Promise<string> {
return $`cat ${path} | wc -l`.text()
}
122 changes: 24 additions & 98 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// eslint.config.js

import antfu from '@antfu/eslint-config'

export default antfu({
Expand All @@ -9,102 +7,30 @@ export default antfu({
quotes: 'single',
},

// Or customize the stylistic rules

typescript: {
tsconfigPath: '.cron/tsconfig.json',
parserOptions: {
project: '.cron/tsconfig.json',
},
},
// Disable jsonc and yaml support
jsonc: true,
yaml: true,
typescript: true,

// `.eslintignore` is no longer supported in Flat config, use `ignores` instead
},
// {
// root: true,
// ignorePatterns: [
// '!.*'
// ],
// parserOptions: {
// ecmaVersion: 'latest',
// sourceType: 'module',
// project: './cron/tsconfig.json'
// },
// plugins: [
// 'unicorn'
// ],
// rules: {
// 'unicorn/template-indent': [
// 'warn',
// {
// tags: [],
// functions: [],
// selectors: [
// 'TemplateLiteral'
// ]
// }
// ]
// },
// globals: {},
// overrides: [
// {
// files: [
// '*',
// '*.ts',
// '*.tsx',
// '*.js',
// '*.mjs'
// ],
// rules: {
// 'template-tag-spacing': [
// 'error',
// 'always'
// ],
// curly: [
// 'error',
// 'multi-line'
// ],
// 'no-console': 'error',
// '@typescript-eslint/comma-dangle': 'off',
// '@typescript-eslint/require-await': [
// 'error'
// ],
// '@typescript-eslint/no-floating-promises': [
// 'error'
// ],
// '@typescript-eslint/no-misused-promises': [
// 'error'
// ],
// 'no-multiple-empty-lines': [
// 'error',
// {
// max: 1,
// maxBOF: 0,
// maxEOF: 0
// }
// ]
// }
// },
// {
// files: [
// 'settings.json',
// 'deno.json*'
// ],
// rules: {
// 'jsonc/sort-keys': [
// 'error',
// 'asc',
// {
// caseSensitive: true,
// natural: false,
// minKeys: 2
// }
// ]
// }
// }
// ]
// }

)

// export default [{
// extends: '@antfu',
// ]
}, {
ignores: [
'*.js',
// '!.*'
],
}, {
files: ['**/*.ts', '.cron/**/*.ts'],
rules: {
'ts/no-unsafe-assignment': 'off',
'ts/no-unsafe-call': 'off',
'ts/no-unsafe-return': 'off',
'ts/no-unsafe-member-access': 'off',
'ts/no-unsafe-argument': 'off',
'ts/require-await': 'error',
'ts/no-floating-promises': 'error',
'ts/no-misused-promises': 'error',
},
})
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"@tsconfig/deno": "^1.0.9",
"@types/node": "^20.11.2",
"eslint": "^8.56.0",
"eslint-plugin-unicorn": "^50.0.1"
"eslint-plugin-unicorn": "^50.0.1",
"typescript": "^5.3.3"
},
"preinstallBinaries": [
"https://raw.githubusercontent.com/borestad/ci-utils/main/bin/dl",
Expand Down

0 comments on commit 2809092

Please sign in to comment.