Skip to content

Commit

Permalink
ci(whatislove-dev/careers-whatislove-dev): update ts/sonar/lit/wb esl…
Browse files Browse the repository at this point in the history
…int plugins wd-270 (#648)
  • Loading branch information
what1s1ove committed Jun 18, 2024
1 parent 0e39828 commit b0cedf1
Show file tree
Hide file tree
Showing 14 changed files with 608 additions and 198 deletions.
6 changes: 4 additions & 2 deletions apps/careers-whatislove-dev/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import baseConfig from '../../eslint.config.js'

/** @typedef {import('eslint').Linter.FlatConfig} */
let FlatConfig
/** @typedef {import('eslint').Linter.RulesRecord} */
let RulesRecord

/** @type {FlatConfig} */
let ignoresConfig = {
Expand All @@ -15,9 +17,9 @@ let ignoresConfig = {
/** @type {FlatConfig} */
let litConfig = {
plugins: {
lit,
lit: lit,
},
rules: lit.configs.all.rules,
rules: /** @type {RulesRecord} */ (lit.configs.all.rules),
}

let litA11yConfig = {
Expand Down
4 changes: 2 additions & 2 deletions apps/careers-whatislove-dev/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
"@ffmpeg-installer/ffmpeg": "1.1.0",
"@ffprobe-installer/ffprobe": "2.1.2",
"@types/fluent-ffmpeg": "2.1.24",
"eslint-plugin-lit": "1.11.0",
"eslint-plugin-lit": "1.14.0",
"eslint-plugin-lit-a11y": "4.1.2",
"eslint-plugin-wc": "2.0.4",
"eslint-plugin-wc": "2.1.0",
"fluent-ffmpeg": "2.1.2",
"vite-plugin-babel": "1.2.0"
}
Expand Down
20 changes: 0 additions & 20 deletions apps/careers-whatislove-dev/packages.d.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
declare module 'eslint-plugin-lit' {
import { type Linter } from 'eslint'

const configs: Record<'all', Required<Linter.FlatConfig>>

export default {
configs,
}
}

declare module 'eslint-plugin-lit-a11y' {
import { type Linter } from 'eslint'

Expand All @@ -17,13 +7,3 @@ declare module 'eslint-plugin-lit-a11y' {
configs,
}
}

declare module 'eslint-plugin-wc' {
import { type Linter } from 'eslint'

const configs: Record<'best-practice', Required<Linter.FlatConfig>>

export default {
configs,
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ class Database {
* @returns {{ set: (payload: Record<string, unknown>) => Promise<void> }}
*/
getTableReference(tableName) {
let reference = ref(this.#instance, `${tableName}/${Date.now()}`)
let reference = ref(
this.#instance,
`${tableName}/${Date.now().toString()}`,
)

return {
/**
Expand Down
4 changes: 2 additions & 2 deletions apps/whatislove-dev/eleventy.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ let init = (config) => {
fonts: [400, 700].map((weight) => ({
data: readFileSync(
new URL(
`src/fonts/red-hat-display-${weight}.woff`,
`src/fonts/red-hat-display-${weight.toString()}.woff`,
import.meta.url,
),
),
Expand Down Expand Up @@ -339,7 +339,7 @@ let init = (config) => {
let extension = extname(source)
let name = basename(source, extension)

return `${name}-${width}w.${format}`
return `${name}-${width.toString()}w.${format.toString()}`
},
formats: [`avif`, `webp`, `png`],
widths: [640, 960, 1280, 1920, 2560],
Expand Down
2 changes: 1 addition & 1 deletion apps/whatislove-dev/src/data/mentions.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ let getDevtoPageMention = async () => {

for (let article of articles) {
let comments = await /** @type {Promise<CommentDevto[]>} */ (
callDevtoApi(`/comments?a_id=${article.id}`)
callDevtoApi(`/comments?a_id=${article.id.toString()}`)
)

let allComments = getAllDevtoComments(comments)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @returns {string}
*/
let getServerApiUrl = ({ apiPrefix = ``, host = ``, port = 0 } = {}) => {
return `${host}${port}${apiPrefix}`
return `${host}${port.toString()}${apiPrefix}`
}

export { getServerApiUrl }
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Http {
}

/**
* @param {Error} error
* @param {unknown} error
* @returns {never}
* @throws {Error}
*/
Expand Down Expand Up @@ -88,7 +88,7 @@ class Http {
.then((response) => /** @type {T} */ (Http.parseJSON(response)))
.catch(
/**
* @param {Error} error
* @param {unknown} error
* @returns {ReturnType<typeof Http.throwError>}
*/
(error) => Http.throwError(error),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ class EasterEgg {
)
let { x, y } = getNodeRandomCoords(easterEggButtonWrapperNode)

easterEggButtonWrapperNode.style.insetBlockStart = `${y}px`
easterEggButtonWrapperNode.style.insetInlineStart = `${x}px`
easterEggButtonWrapperNode.style.insetBlockStart = `${y.toString()}px`
easterEggButtonWrapperNode.style.insetInlineStart = `${x.toString()}px`
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ let generateTocMarkup = (item) => {
if (hasLiNode) {
markup += `
<li class="${BlockName.TOC}__item">
<a class="${BlockName.TOC}__link" href="#${item.slug}">
${item.text}
<a
class="${BlockName.TOC}__link"
href="#${/** @type {string} */ (item.slug).toString()}"
>
${/** @type {string} */ (item.text).toString()}
</a>
`
}
Expand Down
18 changes: 11 additions & 7 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ import globals from 'globals'

/** @typedef {import('eslint').Linter.FlatConfig} */
let FlatConfig
/** @typedef {import('eslint').Linter.ParserModule} */
let ParserModule
/** @typedef {import('eslint').ESLint.Plugin} */
let Plugin
/** @typedef {import('eslint').Linter.RulesRecord} */
let RulesRecord

/** @type {FlatConfig} */
let ignoresConfig = {
Expand Down Expand Up @@ -121,9 +123,9 @@ let importConfig = {
/** @type {FlatConfig} */
let sonarConfig = {
plugins: {
sonarjs,
sonarjs: /** @type {Plugin} */ (/** @type {unknown} */ (sonarjs)),
},
rules: sonarjs.configs.recommended.rules,
rules: /** @type {RulesRecord} */ (sonarjs.configs.recommended.rules),
}

/** @type {FlatConfig} */
Expand Down Expand Up @@ -183,16 +185,18 @@ let jsdocConfig = {
/** @type {FlatConfig} */
let typescriptPlugin = {
languageOptions: {
parser: /** @type {ParserModule} */ (tsParser),
parser: tsParser,
parserOptions: {
project: `./tsconfig.json`,
},
},
plugins: {
'@typescript-eslint': ts,
'@typescript-eslint': /** @type {Plugin} */ (
/** @type {unknown} */ (ts)
),
},
rules: {
...ts.configs[`strict-type-checked`].rules,
...ts.configs[`strict-type-checked`]?.rules,
'@typescript-eslint/no-extraneous-class': [
`error`,
{
Expand Down
Loading

0 comments on commit b0cedf1

Please sign in to comment.