diff --git a/packages/config/package.json b/packages/config/package.json index 9dcc946..4fd8153 100644 --- a/packages/config/package.json +++ b/packages/config/package.json @@ -61,6 +61,7 @@ "dependencies": { "@commitlint/parse": "^19.0.3", "@eslint/js": "^8.57.0", + "@stylistic/eslint-plugin-js": "^2.3.0", "commander": "^12.1.0", "current-git-branch": "^1.1.0", "esbuild-register": "^3.5.0", diff --git a/packages/config/src/eslint/index.js b/packages/config/src/eslint/index.js index ddeecb6..a79562f 100644 --- a/packages/config/src/eslint/index.js +++ b/packages/config/src/eslint/index.js @@ -1,4 +1,5 @@ import tseslint from 'typescript-eslint' +import stylisticJs from '@stylistic/eslint-plugin-js' import pluginImport from 'eslint-plugin-import-x' import pluginNode from 'eslint-plugin-n' import globals from 'globals' @@ -6,6 +7,7 @@ import { javascriptRules } from './javascript.js' import { importRules } from './import.js' import { typescriptRules } from './typescript.js' import { nodeRules } from './node.js' +import { stylisticRules } from './stylistic.js' const GLOB_INCLUDE = ['**/*.{js,svelte,ts,tsx,vue}'] @@ -42,6 +44,8 @@ export const tanstackConfig = [ }, }, plugins: { + // @ts-expect-error + '@stylistic/js': stylisticJs, // @ts-expect-error '@typescript-eslint': tseslint.plugin, // @ts-expect-error @@ -53,6 +57,7 @@ export const tanstackConfig = [ ...typescriptRules, ...importRules, ...nodeRules, + ...stylisticRules, }, }, ] diff --git a/packages/config/src/eslint/stylistic.js b/packages/config/src/eslint/stylistic.js new file mode 100644 index 0000000..51160df --- /dev/null +++ b/packages/config/src/eslint/stylistic.js @@ -0,0 +1,7 @@ +// https://eslint.style/packages/js + +/** @type {import('eslint').Linter.RulesRecord} */ +export const stylisticRules = { + /** Enforce consistency of spacing after the start of a comment */ + '@stylistic/js/spaced-comment': 'error', +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3316db7..5d0d1b6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -88,6 +88,9 @@ importers: '@eslint/js': specifier: ^8.57.0 version: 8.57.0 + '@stylistic/eslint-plugin-js': + specifier: ^2.3.0 + version: 2.3.0(eslint@8.57.0) commander: specifier: ^12.1.0 version: 12.1.0 @@ -717,6 +720,12 @@ packages: '@sinclair/typebox@0.27.8': resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==} + '@stylistic/eslint-plugin-js@2.3.0': + resolution: {integrity: sha512-lQwoiYb0Fs6Yc5QS3uT8+T9CPKK2Eoxc3H8EnYJgM26v/DgtW+1lvy2WNgyBflU+ThShZaHm3a6CdD9QeKx23w==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + eslint: '>=8.40.0' + '@tanstack/query-core@5.51.9': resolution: {integrity: sha512-HsAwaY5J19MD18ykZDS3aVVh+bAt0i7m6uQlFC2b77DLV9djo+xEN7MWQAQQTR8IM+7r/zbozTQ7P0xr0bHuew==} @@ -1307,11 +1316,19 @@ packages: resolution: {integrity: sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + eslint-visitor-keys@4.0.0: + resolution: {integrity: sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + eslint@8.57.0: resolution: {integrity: sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} hasBin: true + espree@10.1.0: + resolution: {integrity: sha512-M1M6CpiE6ffoigIOWYO9UDP8TMUw9kqb21tf+08IgDYjCsOvCuDt4jQcZmoYxx+w7zlKw9/N0KXfto+I8/FrXA==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + espree@9.6.1: resolution: {integrity: sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -3230,6 +3247,14 @@ snapshots: '@sinclair/typebox@0.27.8': {} + '@stylistic/eslint-plugin-js@2.3.0(eslint@8.57.0)': + dependencies: + '@types/eslint': 8.56.11 + acorn: 8.12.0 + eslint: 8.57.0 + eslint-visitor-keys: 4.0.0 + espree: 10.1.0 + '@tanstack/query-core@5.51.9': {} '@tybys/wasm-util@0.9.0': @@ -3919,6 +3944,8 @@ snapshots: eslint-visitor-keys@3.4.3: {} + eslint-visitor-keys@4.0.0: {} + eslint@8.57.0: dependencies: '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0) @@ -3962,6 +3989,12 @@ snapshots: transitivePeerDependencies: - supports-color + espree@10.1.0: + dependencies: + acorn: 8.12.0 + acorn-jsx: 5.3.2(acorn@8.12.0) + eslint-visitor-keys: 4.0.0 + espree@9.6.1: dependencies: acorn: 8.12.0