Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions .changeset/brown-ants-burn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@tanstack/eslint-config': minor
---

chore: update @stylistic/eslint-plugin
6 changes: 6 additions & 0 deletions .changeset/slow-cougars-cut.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@tanstack/config': minor
'@tanstack/eslint-config': minor
---

feat: add eslint-plugin-pnpm
5 changes: 5 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// @ts-check

import { tanstackConfig } from './packages/eslint-config/src/index.js'

export default [...tanstackConfig]
2 changes: 1 addition & 1 deletion integrations/react/tests/build.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { readdirSync, readFileSync } from 'node:fs'
import { readFileSync, readdirSync } from 'node:fs'
import { fileURLToPath } from 'node:url'
import { dirname, resolve } from 'node:path'
import { describe, expect, it } from 'vitest'
Expand Down
2 changes: 1 addition & 1 deletion integrations/vanilla/tests/build.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { readdirSync, readFileSync } from 'node:fs'
import { readFileSync, readdirSync } from 'node:fs'
import { fileURLToPath } from 'node:url'
import { dirname, resolve } from 'node:path'
import { describe, expect, it } from 'vitest'
Expand Down
2 changes: 1 addition & 1 deletion integrations/vue/tests/build.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { readdirSync, readFileSync } from 'node:fs'
import { readFileSync, readdirSync } from 'node:fs'
import { fileURLToPath } from 'node:url'
import { dirname, resolve } from 'node:path'
import { describe, expect, it } from 'vitest'
Expand Down
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"test:ci": "nx run-many --targets=test:eslint,test:types,test:build,test:sherif,build",
"test:build": "nx affected --target=test:build",
"test:types": "nx affected --target=test:types",
"test:eslint": "nx affected --target=test:eslint",
"test:eslint": "eslint '**/*'",
"test:format": "pnpm run prettier --check",
"test:sherif": "sherif",
"build": "nx affected --target=build",
Expand All @@ -27,6 +27,12 @@
"changeset:version": "changeset version && pnpm install --no-frozen-lockfile && pnpm prettier:write",
"changeset:publish": "changeset publish"
},
"nx": {
"includedScripts": [
"test:eslint",
"test:sherif"
]
},
"devDependencies": {
"@changesets/cli": "catalog:",
"@svitejs/changesets-changelog-github-compact": "catalog:",
Expand Down
1 change: 0 additions & 1 deletion packages/config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
},
"scripts": {
"test:types": "tsc",
"test:eslint": "eslint ./src",
"test:build": "publint --strict",
"build": "vite build"
},
Expand Down
5 changes: 0 additions & 5 deletions packages/eslint-config/eslint.config.js

This file was deleted.

6 changes: 4 additions & 2 deletions packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
},
"scripts": {
"test:types": "tsc",
"test:eslint": "eslint ./src",
"test:build": "publint --strict"
},
"type": "module",
Expand All @@ -41,9 +40,12 @@
"@stylistic/eslint-plugin": "catalog:",
"eslint-plugin-import-x": "catalog:",
"eslint-plugin-n": "catalog:",
"eslint-plugin-pnpm": "catalog:",
"globals": "catalog:",
"jsonc-eslint-parser": "catalog:",
"typescript-eslint": "catalog:",
"vue-eslint-parser": "catalog:"
"vue-eslint-parser": "catalog:",
"yaml-eslint-parser": "catalog:"
},
"devDependencies": {
"@types/eslint": "catalog:",
Expand Down
2 changes: 0 additions & 2 deletions packages/eslint-config/src/import.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ export const importRules = {
'import/newline-after-import': 'error',
/** No require() or module.exports */
'import/no-commonjs': 'error',
/** No import loops */
'import/no-cycle': 'error',
/** Reports if a resolved path is imported more than once */
'import/no-duplicates': 'error',
/** Stylistic preference */
Expand Down
57 changes: 43 additions & 14 deletions packages/eslint-config/src/index.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import tseslint from 'typescript-eslint'
import vueparser from 'vue-eslint-parser'
import stylisticJs from '@stylistic/eslint-plugin'
import pluginImport from 'eslint-plugin-import-x'
import pluginNode from 'eslint-plugin-n'
import jsoncParser from 'jsonc-eslint-parser'
import vueParser from 'vue-eslint-parser'
import yamlParser from 'yaml-eslint-parser'
import stylisticPlugin from '@stylistic/eslint-plugin'
import importPlugin from 'eslint-plugin-import-x'
import nodePlugin from 'eslint-plugin-n'
import pnpmPlugin from 'eslint-plugin-pnpm'
import globals from 'globals'
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 JS_GLOB_INCLUDE = ['**/*.{js,ts,tsx}']
const VUE_GLOB_INCLUDE = ['**/*.vue']

const GLOB_EXCLUDE = [
'**/.nx/**',
'**/.svelte-kit/**',
Expand All @@ -32,10 +32,10 @@ const jsRules = {
}

const jsPlugins = {
'@stylistic/js': stylisticJs,
'@stylistic': stylisticPlugin,
'@typescript-eslint': tseslint.plugin,
import: pluginImport,
node: pluginNode,
import: importPlugin,
node: nodePlugin,
}

/** @type {import('eslint').Linter.Config[]} */
Expand All @@ -45,8 +45,8 @@ export const tanstackConfig = [
ignores: GLOB_EXCLUDE,
},
{
name: 'tanstack/setup',
files: JS_GLOB_INCLUDE,
name: 'tanstack/javascript',
files: ['**/*.{js,ts,tsx}'],
languageOptions: {
sourceType: 'module',
ecmaVersion: 2020,
Expand All @@ -66,9 +66,9 @@ export const tanstackConfig = [
},
{
name: 'tanstack/vue',
files: VUE_GLOB_INCLUDE,
files: ['**/*.vue'],
languageOptions: {
parser: vueparser,
parser: vueParser,
parserOptions: {
sourceType: 'module',
ecmaVersion: 2020,
Expand All @@ -84,4 +84,33 @@ export const tanstackConfig = [
plugins: jsPlugins,
rules: jsRules,
},
{
name: 'tanstack/package-json',
files: ['package.json', '**/package.json'],
languageOptions: {
parser: jsoncParser,
},
plugins: {
pnpm: pnpmPlugin,
},
rules: {
'pnpm/json-enforce-catalog': 'error',
'pnpm/json-valid-catalog': 'error',
'pnpm/json-prefer-workspace-settings': 'error',
},
},
{
name: 'tanstack/pnpm-workspace',
files: ['pnpm-workspace.yaml'],
languageOptions: {
parser: yamlParser,
},
plugins: {
pnpm: pnpmPlugin,
},
rules: {
'pnpm/yaml-no-unused-catalog-item': 'error',
'pnpm/yaml-no-duplicate-catalog-item': 'error',
},
},
]
2 changes: 1 addition & 1 deletion packages/eslint-config/src/stylistic.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
/** @type {import('eslint').Linter.RulesRecord} */
export const stylisticRules = {
/** Enforce consistency of spacing after the start of a comment */
'@stylistic/js/spaced-comment': 'error',
'@stylistic/spaced-comment': 'error',
}
5 changes: 0 additions & 5 deletions packages/publish-config/eslint.config.js

This file was deleted.

1 change: 0 additions & 1 deletion packages/publish-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
},
"scripts": {
"test:types": "tsc",
"test:eslint": "eslint ./src",
"test:build": "publint --strict"
},
"type": "module",
Expand Down
5 changes: 0 additions & 5 deletions packages/typedoc-config/eslint.config.js

This file was deleted.

1 change: 0 additions & 1 deletion packages/typedoc-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
},
"scripts": {
"test:types": "tsc",
"test:eslint": "eslint ./src",
"test:build": "publint --strict"
},
"type": "module",
Expand Down
5 changes: 0 additions & 5 deletions packages/vite-config/eslint.config.js

This file was deleted.

1 change: 0 additions & 1 deletion packages/vite-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
},
"scripts": {
"test:types": "tsc",
"test:eslint": "eslint ./src",
"test:build": "publint --strict"
},
"type": "module",
Expand Down
Loading