Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(common): yarn check #485

Merged
merged 42 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
40e4f43
feat(common): yarn check fixes WIP
kirill-ivanovvv Jan 28, 2025
bad95ad
fix(common): yarn check WIP
kirill-ivanovvv Jan 28, 2025
e1ca8fd
style(github): format
kirill-ivanovvv Jan 29, 2025
ab48f23
feat(common): vim coc config
kirill-ivanovvv Jan 29, 2025
dd14dfd
feat(common): yarn unplugged
kirill-ivanovvv Jan 29, 2025
35b9efa
feat(common): yarn skds
kirill-ivanovvv Jan 29, 2025
a7c1553
refactor(cli): yarn check
kirill-ivanovvv Jan 29, 2025
227038c
refactor(prettier): yarn check
kirill-ivanovvv Jan 29, 2025
3632b9c
refactor(schematics): yarn check
kirill-ivanovvv Jan 29, 2025
c93f9fc
refactor(webpack): yarn check
kirill-ivanovvv Jan 29, 2025
c3bb954
refactor(yarn): yarn check
kirill-ivanovvv Jan 29, 2025
24549b0
style(common): format
kirill-ivanovvv Jan 29, 2025
8fc3428
chore(code): checkout from master
kirill-ivanovvv Jan 29, 2025
18c3002
Merge branch 'fix/yarn-check' into fix/check
kirill-ivanovvv Jan 29, 2025
7fc90e5
refactor(connod): yarn releases - rm unused
kirill-ivanovvv Jan 29, 2025
759ae20
style(common): format
kirill-ivanovvv Jan 29, 2025
bee6b70
refactor(common): coc nvim config
kirill-ivanovvv Jan 29, 2025
85dd44d
refactor(yarn): yarn check WIP
kirill-ivanovvv Jan 29, 2025
777d0b0
refactor(webpack): yarn check WIP
kirill-ivanovvv Jan 29, 2025
e696dd4
refactor(schematics): yarn check WIP
kirill-ivanovvv Jan 29, 2025
dc788e5
refactor(prettier): yarn check WIP
kirill-ivanovvv Jan 29, 2025
d76d27e
refactor(code): yarn check WIP
kirill-ivanovvv Jan 29, 2025
48f76e2
refactor(code): yarnc check WIP
kirill-ivanovvv Jan 29, 2025
4bce4a0
refactor(webpack): yarnc check WIP
kirill-ivanovvv Jan 29, 2025
b04442d
style(code): format
kirill-ivanovvv Jan 29, 2025
eb6aea5
refactor(cli): yarn check WIP
kirill-ivanovvv Jan 29, 2025
866ea62
refactor(code): yarn check WIP
kirill-ivanovvv Jan 29, 2025
44410de
refactor(schematics): yarn check WIP
kirill-ivanovvv Jan 29, 2025
6cbbee1
refactor(webpack): yarn check WIP
kirill-ivanovvv Jan 29, 2025
97a6127
refactor(yarn): yarn check WIP
kirill-ivanovvv Jan 29, 2025
09fdeec
style(common): format
kirill-ivanovvv Jan 29, 2025
b72ceb8
chore(common): checkout .yarn from master
kirill-ivanovvv Jan 29, 2025
2b88636
refactor(prettier): add async getter
kirill-ivanovvv Jan 29, 2025
ddb0074
feat(common): unplugged packages
kirill-ivanovvv Jan 29, 2025
5ef06e1
fix(code): skip lib check
kirill-ivanovvv Jan 29, 2025
d304f44
fix(code): schematics skip lib check
kirill-ivanovvv Jan 29, 2025
70d05a0
fix(schematics): prepack
kirill-ivanovvv Jan 29, 2025
ef65fbc
refactor(common): checkout .yarn from master
kirill-ivanovvv Jan 30, 2025
884d4f0
refactor(common): checkout .yarn from master
kirill-ivanovvv Jan 30, 2025
d339c37
refactor(cli): rm unused
kirill-ivanovvv Jan 30, 2025
d2e3a0b
feat(gitignore): add vim
kirill-ivanovvv Jan 30, 2025
97a1937
refactor(common); rm vim
kirill-ivanovvv Jan 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ body:
validations:
required: true

projects: ['atls/11']
projects: ['atls/11']
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ body:
validations:
required: true

projects: ['atls/11']
projects: ['atls/11']
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ body:
validations:
required: true

projects: ['atls/11']
projects: ['atls/11']
24 changes: 20 additions & 4 deletions .pnp.cjs

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

5 changes: 5 additions & 0 deletions .vim/coc-settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"workspace.workspaceFolderCheckCwd": true,
"tsserver.tsdk": ".yarn/sdks/typescript/lib",
"tsserver.useLocalTsdk": true
}
5 changes: 4 additions & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ compressionLevel: mixed
enableGlobalCache: false

packageExtensions:
'@octokit/auth-action@*':
dependencies:
'@octokit/types': '*'
'@actions/github@*':
dependencies:
undici: '*'
Expand Down Expand Up @@ -100,4 +103,4 @@ defaultSemverRangePrefix: ''
preferReuse: true

yarnPath: yarn/cli/src/cli.dev.mjs
#yarnPath: .yarn/releases/yarn-4.5.1.cjs
# yarnPath: .yarn/releases/yarn-4.5.1.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ import React from 'react'

import { ProjectType } from '@atls/schematics'

const Submit = ({ onSubmit, ...props }: any) => {
interface SubmitProps {
onSubmit: (props: ProjectInformationProperties) => void
}

const Submit = ({ onSubmit, ...props }: ProjectInformationProperties & SubmitProps): null => {
useEffect(() => {
onSubmit(props)
}, [props, onSubmit])
Expand All @@ -27,6 +31,11 @@ interface RequestProjectInformationProps {
// TODO: refactor for usage in new plugin
export const RequestProjectInformation: FC<RequestProjectInformationProps> = ({ onSubmit }) => {
const [type, setType] = useState<ProjectType>()

// TODO component
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const IndicatorComponent = 'bla' as any

if (!type) {
return (
<Box flexDirection='column'>
Expand Down
18 changes: 13 additions & 5 deletions code/code-changelog/src/changelog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ export class Changelog {
const config: Options = {
lernaPackage: `${packageName}`,
tagPrefix,
// eslint-disable-next-line no-console
debug: debug ? console.debug : undefined,
// eslint-disable-next-line no-console
warn: console.warn,
append: true,
releaseCount,
Expand All @@ -42,7 +44,7 @@ export class Changelog {
}

if (file) {
return await this.generateToFile(config, path)
return this.generateToFile(config, path)
}

return this.generateToStdOut(config)
Expand All @@ -55,12 +57,16 @@ export class Changelog {
})
let newChangelog = ''

changelogStream.on('data', (chunk) => {
changelogStream.on('data', (chunk: Buffer) => {
newChangelog += chunk.toString()
})

changelogStream.on('end', () => resolve(newChangelog))
changelogStream.on('error', (error) => reject(error))
changelogStream.on('end', () => {
resolve(newChangelog)
})
changelogStream.on('error', (error) => {
reject(error)
})
})
}

Expand All @@ -73,7 +79,8 @@ export class Changelog {

try {
existingData = await readFile(outFile, 'utf8')
} catch (error: any) {
} catch (e: unknown) {
const error = e as Error & { code: string }
if (error.code !== 'ENOENT') throw error
}

Expand All @@ -82,6 +89,7 @@ export class Changelog {

return updatedData
} catch (error) {
// eslint-disable-next-line no-console
console.error('Error generating changelog:', error)
throw error
}
Expand Down
11 changes: 8 additions & 3 deletions code/code-commit/src/commit.linter.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
/* eslint-disable @typescript-eslint/no-shadow */

import type { FormattableReport } from '@commitlint/types'
import type { RuleConfigQuality } from '@commitlint/types'
import type { RulesConfig } from '@commitlint/types'
import type { LintOptions } from '@commitlint/types'
import type { LintOutcome } from '@commitlint/types'
import type { QualifiedRules } from '@commitlint/types'

import { RuleConfigSeverity } from '@commitlint/types'
import { LintOutcome } from '@commitlint/types'
import { QualifiedRules } from '@commitlint/types'
import { format } from '@commitlint/format/lib/format.js'
import commitlint from '@commitlint/lint'

Expand Down Expand Up @@ -55,7 +59,7 @@ export class CommitLinter {
/**
* Prepares config, including scopes
*/
private prepareConfig(rules: QualifiedRules) {
private prepareConfig(rules: QualifiedRules): Partial<RulesConfig<RuleConfigQuality.Qualified>> {
const allowedScopes = []

if (this.scopes) {
Expand All @@ -67,6 +71,7 @@ export class CommitLinter {
}

const possibleScopeValuesArray = ['common', 'github', ...allowedScopes]
// eslint-disable-next-line no-param-reassign
rules['scope-enum'] = [RuleConfigSeverity.Error, 'always', possibleScopeValuesArray]

return rules
Expand Down
48 changes: 25 additions & 23 deletions code/code-format/src/formatter.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import EventEmitter from 'node:events'
import { writeFile } from 'node:fs/promises'
import { readFile } from 'node:fs/promises'
import { relative } from 'node:path'
import { join } from 'node:path'

import * as babel from 'prettier/plugins/babel'
import * as estree from 'prettier/plugins/estree'
import * as graphql from 'prettier/plugins/graphql'
import * as markdown from 'prettier/plugins/markdown'
import * as typescript from 'prettier/plugins/typescript'
import * as yaml from 'prettier/plugins/yaml'
import { globby } from 'globby'
import { format } from 'prettier/standalone'
import ignorer from 'ignore'

import config from '@atls/config-prettier'
import plugin from '@atls/prettier-plugin'

import { ignore } from './formatter.patterns.js'
import { createPatterns } from './formatter.patterns.js'
import EventEmitter from 'node:events'
import { writeFile } from 'node:fs/promises'
import { readFile } from 'node:fs/promises'
import { relative } from 'node:path'
import { join } from 'node:path'

import * as babel from 'prettier/plugins/babel'
import * as estree from 'prettier/plugins/estree'
import * as graphql from 'prettier/plugins/graphql'
import * as markdown from 'prettier/plugins/markdown'
import * as typescript from 'prettier/plugins/typescript'
import * as yaml from 'prettier/plugins/yaml'
import { globby } from 'globby'
import { format } from 'prettier/standalone'
import ignorer from 'ignore'

import { getPrettierPlugin } from '@atls/prettier-plugin'
import config from '@atls/config-prettier'

import { ignore } from './formatter.patterns.js'
import { createPatterns } from './formatter.patterns.js'

export class Formatter extends EventEmitter {
constructor(private readonly cwd: string) {
Expand All @@ -38,6 +38,8 @@ export class Formatter extends EventEmitter {
}

protected async formatFiles(files: Array<string> = []): Promise<void> {
const prettierPlugin = await getPrettierPlugin()

const formatFiles = ignorer
.default()
.add(ignore)
Expand All @@ -54,8 +56,8 @@ export class Formatter extends EventEmitter {
const output = await format(input, {
...config,
filepath: filename,
// @ts-expect-error any
plugins: [estree, yaml, markdown, graphql, babel, typescript, plugin],
// @ts-expect-error type not assignable
plugins: [estree, yaml, markdown, graphql, babel, typescript, prettierPlugin],
})

if (output !== input && output) {
Expand Down
9 changes: 8 additions & 1 deletion code/code-github/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
"@octokit/auth-action": "5.1.1",
"@octokit/rest": "21.0.2"
},
"devDependencies": {
"@octokit/types": "13.5.0"
},
"peerDependencies": {
"@octokit/types": "*"
},
"publishConfig": {
"access": "public",
"exports": {
Expand All @@ -32,5 +38,6 @@
},
"main": "dist/index.js",
"types": "dist/index.d.ts"
}
},
"typecheckSkipLibCheck": true
}
6 changes: 3 additions & 3 deletions code/code-github/src/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ export class Release {
}

async create(options: CreateOptions): Promise<number> {
const { owner, repo, tag_name, name, make_latest, draft, body } = options
const { owner, repo, tag_name: tagName, name, make_latest: makeLatest, draft, body } = options

const result = await this.client.repos.createRelease({
owner,
repo,
tag_name,
tag_name: tagName,
draft,
make_latest: make_latest ? 'true' : 'false',
make_latest: makeLatest ? 'true' : 'false',
name,
body,
})
Expand Down
2 changes: 1 addition & 1 deletion code/code-jsr/src/jsr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { publish } from 'jsr'
export class JSR {
constructor(private readonly cwd: string) {}

async publish(options: PublishOptions) {
async publish(options: PublishOptions): Promise<void> {
await publish(this.cwd, options)
}
}
5 changes: 3 additions & 2 deletions code/code-lint/src/linter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export class Linter extends EventEmitter {
return this.lintFiles(finalFiles, options)
}

private async lintWithCache(files: Array<string> = []): Promise<ESLint.LintResult[]> {
private async lintWithCache(files: Array<string> = []): Promise<Array<ESLint.LintResult>> {
this.emit('start', { files })

const results = await this.cacheLinter?.lintFiles(files)
Expand All @@ -139,10 +139,11 @@ export class Linter extends EventEmitter {
}

private getProjectIgnorePatterns(): Array<string> {
// eslint-disable-next-line n/no-sync
const content = readFileSync(join(this.cwd, 'package.json'), 'utf-8')

const { linterIgnorePatterns = [] } = JSON.parse(content)

return linterIgnorePatterns
return linterIgnorePatterns as Array<string>
}
}
2 changes: 1 addition & 1 deletion code/code-pack/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as tagUtils from './tag.utils.js'

export * from './pack.interfaces.js'
export type * from './pack.interfaces.js'
export * from './tag.utils.js'
export * from './pack.js'

Expand Down
2 changes: 1 addition & 1 deletion code/code-pack/src/pack.interfaces.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PortablePath } from '@yarnpkg/fslib'
import type { PortablePath } from '@yarnpkg/fslib'

export interface PackOptions {
workspace: string
Expand Down
2 changes: 2 additions & 0 deletions code/code-pack/src/pack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export const pack = async (

await xfs.writeFilePromise(descriptorPath, stringify(descriptor))

// eslint-disable-next-line no-console, n/no-sync
console.debug('project.toml', readFileSync(descriptorPath, 'utf8'))

const args = [
Expand All @@ -96,6 +97,7 @@ export const pack = async (
args.push('--platform', platform)
}

// eslint-disable-next-line no-console
console.debug(`Packing with args:`, args)

await installPack({ cwd, context })
Expand Down
Loading
Loading