Initial rebrand: @polkadot -> @pezkuwi (3 packages)

- Package namespace: @polkadot/dev -> @pezkuwi/dev
- Repository: polkadot-js/dev -> pezkuwichain/pezkuwi-dev
- Author: Pezkuwi Team <team@pezkuwichain.io>

Packages:
- @pezkuwi/dev (build tools, linting, CI scripts)
- @pezkuwi/dev-test (test runner)
- @pezkuwi/dev-ts (TypeScript build)

Upstream: polkadot-js/dev v0.83.3
This commit is contained in:
2026-01-05 14:22:47 +03:00
commit 8d28b36f9c
135 changed files with 19232 additions and 0 deletions
+160
View File
@@ -0,0 +1,160 @@
// Copyright 2017-2025 @polkadot/dev authors & contributors
// SPDX-License-Identifier: Apache-2.0
// @ts-expect-error No definition for this one
import eslintJs from '@eslint/js';
import tsPlugin from '@typescript-eslint/eslint-plugin';
import tsParser from '@typescript-eslint/parser';
// @ts-expect-error No definition for this one
import standardConfig from 'eslint-config-standard';
import deprecationPlugin from 'eslint-plugin-deprecation';
// @ts-expect-error No definition for this one
import headerPlugin from 'eslint-plugin-header';
// @ts-expect-error No definition for this one
import importPlugin from 'eslint-plugin-import';
// @ts-expect-error No definition for this one
import importNewlinesPlugin from 'eslint-plugin-import-newlines';
// @ts-expect-error No definition for this one
import jestPlugin from 'eslint-plugin-jest';
// @ts-expect-error No definition for this one
import nPlugin from 'eslint-plugin-n';
// @ts-expect-error No definition for this one
import promisePlugin from 'eslint-plugin-promise';
// @ts-expect-error No definition for this one
import reactPlugin from 'eslint-plugin-react';
// @ts-expect-error No definition for this one
import reactHooksPlugin from 'eslint-plugin-react-hooks';
// @ts-expect-error No definition for this one
import simpleImportSortPlugin from 'eslint-plugin-simple-import-sort';
// @ts-expect-error No definition for this one
import sortDestructureKeysPlugin from 'eslint-plugin-sort-destructure-keys';
import globals from 'globals';
import { overrideAll, overrideJs, overrideJsx, overrideSpec } from './eslint.rules.js';
const EXT_JS = ['.cjs', '.js', '.mjs'];
const EXT_TS = ['.ts', '.tsx'];
const EXT_ALL = [...EXT_JS, ...EXT_TS];
/**
* @internal
* Converts a list of EXT_* defined above to globs
* @param {string[]} exts
* @returns {string[]}
*/
function extsToGlobs (exts) {
return exts.map((e) => `**/*${e}`);
}
export default [
{
ignores: [
'**/.github/',
'**/.vscode/',
'**/.yarn/',
'**/build/',
'**/build-*/',
'**/coverage/'
]
},
{
languageOptions: {
globals: {
...globals.browser,
...globals.node
},
parser: tsParser,
parserOptions: {
ecmaVersion: 'latest',
project: './tsconfig.eslint.json',
sourceType: 'module',
warnOnUnsupportedTypeScriptVersion: false
}
},
plugins: {
'@typescript-eslint': tsPlugin,
deprecation: deprecationPlugin,
header: headerPlugin,
import: importPlugin,
'import-newlines': importNewlinesPlugin,
n: nPlugin,
promise: promisePlugin,
'simple-import-sort': simpleImportSortPlugin,
'sort-destructure-keys': sortDestructureKeysPlugin
},
settings: {
'import/extensions': EXT_ALL,
'import/parsers': {
'@typescript-eslint/parser': EXT_TS,
espree: EXT_JS
},
'import/resolver': {
node: {
extensions: EXT_ALL
},
typescript: {
project: './tsconfig.eslint.json'
}
}
}
},
{
files: extsToGlobs(EXT_ALL),
rules: {
...eslintJs.configs.recommended.rules,
...standardConfig.rules,
...tsPlugin.configs['recommended-type-checked'].rules,
...tsPlugin.configs['stylistic-type-checked'].rules,
...overrideAll
}
},
{
files: extsToGlobs(EXT_JS),
rules: {
...overrideJs
}
},
{
files: [
'**/*.tsx',
'**/use*.ts'
],
plugins: {
react: reactPlugin,
'react-hooks': reactHooksPlugin
},
rules: {
...reactPlugin.configs.recommended.rules,
...reactHooksPlugin.configs.recommended.rules,
...overrideJsx
},
settings: {
react: {
version: 'detect'
}
}
},
{
files: [
'**/*.spec.ts',
'**/*.spec.tsx'
],
languageOptions: {
globals: {
...globals.jest
}
},
plugins: {
jest: jestPlugin
},
rules: {
...jestPlugin.configs.recommended.rules,
...overrideSpec
},
settings: {
jest: {
version: 27
}
}
}
];
+214
View File
@@ -0,0 +1,214 @@
// Copyright 2017-2025 @polkadot/dev authors & contributors
// SPDX-License-Identifier: Apache-2.0
import JSON5 from 'json5';
import fs from 'node:fs';
import path from 'node:path';
import process from 'node:process';
const FIXME = {
// This is in the new 6.0.0 and we should switch this on
// at some point. For a first iteration we keep as-is
'@typescript-eslint/prefer-nullish-coalescing': 'off'
};
/**
* Returns a copyright header pattern (using tsconfig.base.json)
*
* @returns {string}
*/
function getHeaderPattern () {
const tsPath = path.join(process.cwd(), 'tsconfig.base.json');
if (!fs.existsSync(tsPath)) {
throw new Error(`Unable to load ${tsPath}`);
}
const tsConfig = JSON5.parse(fs.readFileSync(tsPath, 'utf-8'));
if (!tsConfig?.compilerOptions?.paths) {
throw new Error(`Unable to extract compilerOptions.paths structure from ${tsPath}`);
}
const paths = Object.keys(tsConfig.compilerOptions.paths);
if (!paths.length) {
throw new Error(`No keys found in compilerOptions.paths from ${tsPath}`);
}
const packages = paths.reduce((packages, k) => {
const [pd, pk] = k.split('/');
if (pd !== '@polkadot' || !pk) {
throw new Error(`Non @polkadot path in ${tsPath}`);
}
return packages.length
? `${packages}|${pk}`
: pk;
}, '');
const fullyear = new Date().getFullYear();
const years = [];
for (let i = 17, last = fullyear - 2000; i < last; i++) {
years.push(`${i}`);
}
return ` Copyright 20(${years.join('|')})(-${fullyear})? @polkadot/(${packages})`;
}
export const overrideAll = {
...FIXME,
// the next 2 enforce isolatedModules & verbatimModuleSyntax
'@typescript-eslint/consistent-type-exports': 'error',
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/dot-notation': 'error',
'@typescript-eslint/indent': ['error', 2],
'@typescript-eslint/no-non-null-assertion': 'error',
// ts itself checks and ignores those starting with _, align the linting
'@typescript-eslint/no-unused-vars': ['error', {
args: 'all',
argsIgnorePattern: '^_',
caughtErrors: 'all',
caughtErrorsIgnorePattern: '^_',
destructuredArrayIgnorePattern: '^_',
vars: 'all',
varsIgnorePattern: '^_'
}],
'@typescript-eslint/type-annotation-spacing': 'error',
'arrow-parens': ['error', 'always'],
'brace-style': ['error', '1tbs'],
curly: ['error', 'all'],
'default-param-last': 'off', // conflicts with TS version
'deprecation/deprecation': 'error',
'dot-notation': 'off', // conflicts with TS version
'func-style': ['error', 'declaration', {
allowArrowFunctions: true
}],
// this does help with declarations, but also
// applies to invocations, which is an issue...
// 'function-paren-newline': ['error', 'never'],
'function-call-argument-newline': ['error', 'consistent'],
'header/header': ['error', 'line', [
{ pattern: getHeaderPattern() },
' SPDX-License-Identifier: Apache-2.0'
], 2],
'import-newlines/enforce': ['error', {
forceSingleLine: true,
items: 2048
}],
'import/export': 'error',
'import/extensions': ['error', 'ignorePackages', {
cjs: 'always',
js: 'always',
json: 'always',
jsx: 'never',
mjs: 'always',
ts: 'never',
tsx: 'never'
}],
'import/first': 'error',
'import/newline-after-import': 'error',
'import/no-duplicates': 'error',
'import/order': 'off', // conflicts with simple-import-sort
indent: 'off', // required as 'off' since typescript-eslint has own versions
'no-extra-semi': 'error',
'no-unused-vars': 'off',
'no-use-before-define': 'off',
'object-curly-newline': ['error', {
ExportDeclaration: { minProperties: 2048 },
ImportDeclaration: { minProperties: 2048 },
ObjectPattern: { minProperties: 2048 }
}],
'padding-line-between-statements': [
'error',
{ blankLine: 'always', next: '*', prev: ['const', 'let', 'var'] },
{ blankLine: 'any', next: ['const', 'let', 'var'], prev: ['const', 'let', 'var'] },
{ blankLine: 'always', next: 'block-like', prev: '*' },
{ blankLine: 'always', next: '*', prev: 'block-like' },
{ blankLine: 'always', next: 'function', prev: '*' },
{ blankLine: 'always', next: '*', prev: 'function' },
{ blankLine: 'always', next: 'try', prev: '*' },
{ blankLine: 'always', next: '*', prev: 'try' },
{ blankLine: 'always', next: 'return', prev: '*' },
{ blankLine: 'always', next: 'import', prev: '*' },
{ blankLine: 'always', next: '*', prev: 'import' },
{ blankLine: 'any', next: 'import', prev: 'import' }
],
semi: ['error', 'always'],
'simple-import-sort/exports': 'error',
'simple-import-sort/imports': ['error', {
groups: [
['^\u0000'], // all side-effects (0 at start)
['\u0000$', '^@polkadot.*\u0000$', '^\\..*\u0000$'], // types (0 at end)
// ['^node:'], // node
['^[^/\\.]'], // non-polkadot
['^@polkadot'], // polkadot
['^\\.\\.(?!/?$)', '^\\.\\./?$', '^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'] // local (. last)
]
}],
'sort-destructure-keys/sort-destructure-keys': ['error', {
caseSensitive: true
}],
'sort-keys': 'error',
'spaced-comment': ['error', 'always', {
block: {
// pure export helpers
markers: ['#__PURE__']
},
line: {
// TS reference types
markers: ['/ <reference']
}
}]
};
export const overrideJsx = {
'jsx-quotes': ['error', 'prefer-single'],
// swap from recommended warning to error
'react-hooks/exhaustive-deps': 'error',
'react/jsx-closing-bracket-location': ['warn', 'tag-aligned'],
'react/jsx-first-prop-new-line': ['warn', 'multiline-multiprop'],
'react/jsx-fragments': 'error',
'react/jsx-max-props-per-line': ['warn', {
maximum: 1,
when: 'always'
}],
'react/jsx-newline': ['error', {
prevent: true
}],
'react/jsx-no-bind': 'error',
'react/jsx-props-no-multi-spaces': 'error',
'react/jsx-sort-props': ['warn', {
noSortAlphabetically: false
}],
'react/jsx-tag-spacing': ['error', {
afterOpening: 'never',
beforeClosing: 'never',
beforeSelfClosing: 'always',
closingSlash: 'never'
}],
'react/prop-types': 'off' // this is a completely broken rule
};
export const overrideJs = {
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/restrict-plus-operands': 'off',
'@typescript-eslint/restrict-template-expressions': 'off'
};
export const overrideSpec = {
// in the specs we are a little less worried about
// specific correctness, i.e. we can have dangling bits
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'jest/expect-expect': ['warn', {
assertFunctionNames: ['assert', 'expect']
}]
};
+22
View File
@@ -0,0 +1,22 @@
// Copyright 2017-2025 @polkadot/dev authors & contributors
// SPDX-License-Identifier: Apache-2.0
module.exports = {
arrowParens: 'always',
bracketSpacing: true,
embeddedLanguageFormatting: 'off',
endOfLine: 'lf',
htmlWhitespaceSensitivity: 'ignore',
jsxBracketSameLine: false,
jsxSingleQuote: true,
parser: 'typescript',
printWidth: 2048,
proseWrap: 'preserve',
quoteProps: 'as-needed',
requirePragma: true, // only on those files explicitly asked for
semi: true,
singleQuote: true,
tabWidth: 2,
trailingComma: 'none',
useTabs: false
};
+113
View File
@@ -0,0 +1,113 @@
// Copyright 2017-2025 @polkadot/dev authors & contributors
// SPDX-License-Identifier: Apache-2.0
import pluginAlias from '@rollup/plugin-alias';
import pluginCommonjs from '@rollup/plugin-commonjs';
import pluginDynamicImportVars from '@rollup/plugin-dynamic-import-vars';
import pluginInject from '@rollup/plugin-inject';
import pluginJson from '@rollup/plugin-json';
import { nodeResolve as pluginResolve } from '@rollup/plugin-node-resolve';
import fs from 'node:fs';
import path from 'node:path';
import pluginCleanup from 'rollup-plugin-cleanup';
/** @typedef {{ entries?: Record<string, string>; external: string[]; globals?: Record<string, string>; index?: string; inject?: Record<string, string>; pkg: string; }} BundleDef */
/** @typedef {{ file: string; format: 'umd'; generatedCode: Record<string, unknown>; globals: Record<string, string>; inlineDynamicImports: true; intro: string; name: string; }} BundleOutput */
/** @typedef {{ context: 'global'; external: string[]; input: string; output: BundleOutput; plugins: any[]; }} Bundle */
/**
* @param {string} pkg
* @returns {string}
*/
function sanitizePkg (pkg) {
return pkg.replace('@polkadot/', '');
}
/**
* @param {string} input
* @returns {string}
*/
function createName (input) {
return `polkadot-${sanitizePkg(input)}`
.toLowerCase()
.replace(/[^a-zA-Z0-9]+(.)/g, (_, c) => c.toUpperCase());
}
/**
* @param {string} pkg
* @param {string} [index]
* @returns {string}
*/
export function createInput (pkg, index) {
const partialPath = `packages/${sanitizePkg(pkg)}/build`;
return `${partialPath}/${
index ||
fs.existsSync(path.join(process.cwd(), partialPath, 'bundle.js'))
? 'bundle.js'
: (
JSON.parse(fs.readFileSync(path.join(process.cwd(), partialPath, 'package.json'), 'utf8')).browser ||
'index.js'
)
}`;
}
/**
*
* @param {string} pkg
* @param {string[]} external
* @param {Record<string, string>} globals
* @returns {BundleOutput}
*/
export function createOutput (pkg, external, globals) {
const name = sanitizePkg(pkg);
return {
file: `packages/${name}/build/bundle-polkadot-${name}.js`,
format: 'umd',
generatedCode: {
constBindings: true
},
globals: external.reduce((all, p) => ({
[p]: createName(p),
...all
}), { ...globals }),
// combine multi-chunk builds with dynamic imports
inlineDynamicImports: true,
// this is a mini x-global, determine where our context lies
intro: 'const global = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : window;',
name: createName(pkg)
};
}
/**
*
* @param {BundleDef} param0
* @returns {Bundle}
*/
export function createBundle ({ entries = {}, external, globals = {}, index, inject = {}, pkg }) {
return {
// specify this (we define global in the output intro as globalThis || self || window)
context: 'global',
external,
input: createInput(pkg, index),
output: createOutput(pkg, external, globals),
// NOTE The expect-error directives are due to rollup plugins, see
// - https://github.com/rollup/plugins/issues/1488
// - https://github.com/rollup/plugins/issues/1329
plugins: [
// @ts-expect-error See the linked rollup issues above
pluginAlias({ entries }),
// @ts-expect-error See the linked rollup issues above
pluginJson(),
// @ts-expect-error See the linked rollup issues above
pluginCommonjs(),
// @ts-expect-error See the linked rollup issues above
pluginDynamicImportVars(),
// @ts-expect-error See the linked rollup issues above
pluginInject(inject),
pluginResolve({ browser: true }),
pluginCleanup()
]
};
}
+32
View File
@@ -0,0 +1,32 @@
{
/**
* There uses the strictest configs as the base
* https://github.com/tsconfig/bases/blob/f674fa6cbca17062ff02511b02872f8729a597ec/bases/strictest.json
*/
"extends": "@tsconfig/strictest/tsconfig.json",
"compilerOptions": {
/**
* Aligns with packages/dev/scripts/polkadot-dev-build-ts & packages/dev-ts/src/loader
* (target here is specifically tied to the minimum supported Node version)
*/
"module": "nodenext",
"moduleResolution": "nodenext",
"target": "es2022",
/**
* Specific compilation configs for polkadot-js projects as it is used
* (we only compile *.d.ts via the tsc command-line)
*/
"declaration": true,
"emitDeclarationOnly": true,
"jsx": "preserve",
"verbatimModuleSyntax": true,
/**
* These appear in strictest, however we don't (yet) use them. For the most part it means
* that we actually do have a large number of these lurking (especially on index checks)
*/
"exactOptionalPropertyTypes": false,
"noUncheckedIndexedAccess": false,
}
}
+18
View File
@@ -0,0 +1,18 @@
// Copyright 2017-2025 @polkadot/dev authors & contributors
// SPDX-License-Identifier: Apache-2.0
module.exports = {
exclude: '**/*+(index|e2e|spec|types).ts',
excludeExternals: true,
excludeNotExported: true,
excludePrivate: true,
excludeProtected: true,
hideGenerator: true,
includeDeclarations: false,
module: 'commonjs',
moduleResolution: 'node',
name: 'polkadot{.js}',
out: 'docs',
stripInternal: 'true',
theme: 'markdown'
};