@naturalcycles/dev-lib 20.31.1 → 20.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cfg/biome.jsonc CHANGED
@@ -2,7 +2,18 @@
2
2
  "$schema": "https://biomejs.dev/schemas/2.3.10/schema.json",
3
3
  "root": false,
4
4
  "files": {
5
- "includes": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx", "!**/__exclude", "!**/try.ts"],
5
+ "includes": [
6
+ "**/*.ts",
7
+ "**/*.tsx",
8
+ "**/*.js",
9
+ "**/*.jsx",
10
+ "!**/__exclude",
11
+ "!tmp",
12
+ "!coverage",
13
+ "!deploy",
14
+ "!dist",
15
+ "!**/try.ts",
16
+ ],
6
17
  },
7
18
  "formatter": {
8
19
  "enabled": true,
@@ -33,7 +33,7 @@ export default {
33
33
  },
34
34
  ],
35
35
  '@typescript-eslint/consistent-type-imports': 0, // ox
36
- '@typescript-eslint/consistent-type-exports': 2,
36
+ '@typescript-eslint/consistent-type-exports': 0, // ox
37
37
  '@typescript-eslint/consistent-type-assertions': 2,
38
38
  '@typescript-eslint/consistent-type-definitions': [0, 'interface'], // ox
39
39
  '@typescript-eslint/consistent-generic-constructors': [0, 'constructor'], // ox
@@ -8,7 +8,6 @@ import eslint from '@eslint/js'
8
8
  import eslintPluginOxlint from 'eslint-plugin-oxlint'
9
9
  import globals from 'globals'
10
10
  import tseslint from 'typescript-eslint'
11
- import eslintBiomeRules from './eslint-biome-rules.js'
12
11
  import eslintPrettierRules from './eslint-prettier-rules.js'
13
12
  import eslintRules from './eslint-rules.js'
14
13
 
@@ -122,7 +121,7 @@ function getConfig(_tsconfigPath) {
122
121
  ...eslintRules.rules,
123
122
  // ...eslintVueRules.rules,
124
123
  ...eslintPrettierRules.rules, // disable eslint rules already covered by prettier
125
- ...eslintBiomeRules.rules, // disable eslint rules already covered by biome
124
+ // ...eslintBiomeRules.rules, // disable eslint rules already covered by biome
126
125
  ...eslintPluginOxlint.configs['flat/all'][0].rules, // disable eslint rules already covered by oxlint
127
126
  // rules that are disabled, but shouldn't yet be disabled
128
127
  '@typescript-eslint/return-await': [2, 'always'],
@@ -7,7 +7,6 @@ const {
7
7
  platform,
8
8
  arch,
9
9
  versions: { node },
10
- // env: { ESLINT_CONCURRENCY },
11
10
  } = process
12
11
 
13
12
  console.log(`lint-staged.config.js runs on node ${node} ${platform} ${arch}`)
@@ -43,9 +42,6 @@ if (eslintConfigPath) {
43
42
  `--config ${eslintConfigPath}`,
44
43
  '--cache',
45
44
  '--cache-location node_modules/.cache/eslint',
46
- // concurrency is disabled here, as it's not expected to help,
47
- // since we're running on a limited set of files already
48
- // ESLINT_CONCURRENCY && `--concurrency=${ESLINT_CONCURRENCY}`,
49
45
  ]
50
46
  .filter(Boolean)
51
47
  .join(' ')
@@ -88,7 +84,7 @@ const linters = {
88
84
  // ktlint
89
85
  '**/*.{kt,kts}': runKtlint,
90
86
 
91
- './.github/**/*.{yml,yaml}': runActionlint,
87
+ './.github/**/*.{yml,yaml}': runActionlintOxfmt,
92
88
  }
93
89
 
94
90
  export function runBiomeEslintStylelintOxfmt(match) {
@@ -131,20 +127,26 @@ export function runKtlint(match) {
131
127
  return [`${dir}/resources/ktlint -F ${filesList}`]
132
128
  }
133
129
 
134
- export function runActionlint(match) {
130
+ export function runActionlintOxfmt(match) {
135
131
  if (!match.length) return []
136
132
 
137
- if (!canRunBinary('actionlint')) {
133
+ const tools = []
134
+
135
+ if (canRunBinary('actionlint')) {
136
+ requireActionlintVersion()
137
+ // run actionlint on all files at once, as it's fast anyway
138
+ tools.push('actionlint')
139
+ } else {
138
140
  console.log(
139
141
  `actionlint is not installed and won't be run.\nThis is how to install it: https://github.com/rhysd/actionlint/blob/main/docs/install.md`,
140
142
  )
141
- return []
142
143
  }
143
144
 
144
- requireActionlintVersion()
145
+ if (oxfmtCmd) {
146
+ tools.push(oxfmtCmd)
147
+ }
145
148
 
146
- // run actionlint on all files at once, as it's fast anyway
147
- return [`actionlint`]
149
+ return tools
148
150
  }
149
151
 
150
152
  function getFilesList(match) {
@@ -13,6 +13,14 @@
13
13
  ],
14
14
  "jsPlugins": ["./oxlint-plugin-stylistic.mjs"],
15
15
  "rules": {
16
+ "no-unused-vars": [
17
+ "error",
18
+ {
19
+ "varsIgnorePattern": "^(_$|__)",
20
+ "argsIgnorePattern": "^_",
21
+ "destructuredArrayIgnorePattern": "^_"
22
+ }
23
+ ],
16
24
  "@stylistic/padding-line-between-statements": [
17
25
  2,
18
26
  { "blankLine": "always", "prev": "function", "next": "*" },
@@ -3,7 +3,7 @@ import { _by } from '@naturalcycles/js-lib/array/array.util.js';
3
3
  import { _assert } from '@naturalcycles/js-lib/error/assert.js';
4
4
  import { fs2 } from '@naturalcycles/nodejs-lib/fs2';
5
5
  import { runScript } from '@naturalcycles/nodejs-lib/runScript';
6
- import { buildCopy, buildProd, eslintAll, lintStagedCommand, requireOxlintConfig, runBiome, runCheck, runOxfmt, runOxlint, runTest, stylelintAll, typecheckWithTS, typecheckWithTSC, typecheckWithTSGO, } from '../check.util.js';
6
+ import { buildCopy, buildProd, eslintAll, lintStagedCommand, runBiome, runCheck, runOxfmt, runOxlint, runTest, stylelintAll, typecheckWithTS, typecheckWithTSC, typecheckWithTSGO, } from '../check.util.js';
7
7
  import { runCommitlint } from '../commitlint.js';
8
8
  const commands = [
9
9
  { name: 'check', fn: runCheck, desc: '"Run all possible checks": lint, typecheck, then test.' },
@@ -175,11 +175,11 @@ async function bt() {
175
175
  await typecheckWithTS();
176
176
  runTest();
177
177
  }
178
- async function _typecheckWithOxlint() {
179
- requireOxlintConfig();
180
- const fix = !CI;
181
- runOxlint(fix);
182
- }
178
+ // async function _typecheckWithOxlint(): Promise<void> {
179
+ // requireOxlintConfig()
180
+ // const fix = !CI
181
+ // runOxlint(fix)
182
+ // }
183
183
  async function cleanBuild() {
184
184
  cleanDist();
185
185
  buildProd();
@@ -16,7 +16,7 @@ import { kpySync } from '@naturalcycles/nodejs-lib/kpy';
16
16
  import { _yargs } from '@naturalcycles/nodejs-lib/yargs';
17
17
  import { eslintExtensions, lintExclude, minActionlintVersion, prettierDirs, stylelintExtensions, } from '../cfg/_cnst.js';
18
18
  import { cfgDir } from './paths.js';
19
- const { CI, ESLINT_CONCURRENCY } = process.env;
19
+ const { CI } = process.env;
20
20
  /**
21
21
  * Run all linters.
22
22
  *
@@ -178,7 +178,6 @@ function runESLint(extensions = eslintExtensions.split(','), fix = true) {
178
178
  // `--parser-options=project:${tsconfigPath}`,
179
179
  // The next line fixes the `typescript-eslint` 8.37 bug of resolving tsconfig.json
180
180
  // `--parser-options=tsconfigRootDir:${tsconfigRootDir}`,
181
- ESLINT_CONCURRENCY && `--concurrency=${ESLINT_CONCURRENCY}`,
182
181
  '--cache',
183
182
  '--cache-location',
184
183
  cacheLocation,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@naturalcycles/dev-lib",
3
3
  "type": "module",
4
- "version": "20.31.1",
4
+ "version": "20.32.0",
5
5
  "dependencies": {
6
6
  "@biomejs/biome": "^2",
7
7
  "prompts": "^2",