Index of every page on this site: llms.txt
All skills
fubits1 avatar

/js-config

@a024d57
by Iljafubits1/svelte-skills11 stars
2
Run it yourself

Use when editing ESLint, Prettier, Stylelint, PostCSS, or Svelte config files. Use when adding or removing linting plugins, resolving formatter conflicts, auditing JS/TS toolchain configuration, or deciding whether a config package is needed.

Use this Skill: https://skilld.dev/gh/fubits1/svelte-skills/js-config

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

eslint-prettier.md

≈1.7k tokens on demand. Your agent reads this file only when SKILL.md points to it.

ESLint + Prettier Integration

The Problem

ESLint and Prettier can fight over formatting. ESLint has formatting rules (indent, quotes, semi). Prettier has opinions about the same things. If both are active, you get conflicting errors.

Three Packages: Different Jobs

eslint-config-prettier

Turns OFF ESLint rules that conflict with Prettier. Does nothing else. Must be imported and placed last in config array to override earlier configs.

// flat config (eslint.config.js)
import eslintConfigPrettier from 'eslint-config-prettier/flat'

export default [
  js.configs.recommended,
  tseslint.configs.recommended,
  eslintConfigPrettier // LAST — overrides formatting rules from above
]

When needed: Only if ESLint configs above it enable formatting rules. Legacy configs (airbnb, standard) do. Modern recommended configs do not.

When NOT needed: If pnpm exec eslint-config-prettier src/some-file.js reports "No rules that are unnecessary or conflict with Prettier were found."

If installed but not imported: Zero effect. Safe to remove.

eslint-plugin-prettier

Runs Prettier as an ESLint rule. Reports formatting differences as ESLint errors.

import prettier from 'eslint-plugin-prettier'

export default [
  {
    plugins: { prettier },
    rules: { 'prettier/prettier': 'warn' } // or 'off' to just register plugin
  }
]

Generally not recommended. Slower than running Prettier separately. Worse editor experience, red squiggles for formatting. Prefer running Prettier via format-on-save or prettier --check in CI.

Pattern seen in the wild: Register plugin but disable rule ('prettier/prettier': 'off'). Registers Prettier as plugin without running it as linter. Unclear benefit, possibly leftover from migration.

svelte.configs.prettier (built into eslint-plugin-svelte)

Disables Svelte-specific rules that conflict with Prettier. Same concept as eslint-config-prettier but scoped to eslint-plugin-svelte rules only.

import svelte from 'eslint-plugin-svelte'

export default [
  svelte.configs.recommended,
  svelte.configs.prettier // disables svelte formatting rules
]

Verification

# Check if ANY active rules conflict with Prettier
pnpm exec eslint-config-prettier src/some-file.js
pnpm exec eslint-config-prettier src/components/Example.svelte
pnpm exec eslint-config-prettier src/pages/index.astro

# Check which rules are active (look for formatting rules)
pnpm exec eslint --print-config src/some-file.js | grep -i "indent\|quotes\|semi\|comma\|spacing"

Flat Config Pattern: Astro + Svelte + TS

Two real-world flat-config examples.

Minimal (no prettier plugin, no a11y)

import eslintPluginAstro from 'eslint-plugin-astro'
import eslintPluginSvelte from 'eslint-plugin-svelte'
import tsParser from '@typescript-eslint/parser'
import * as depend from 'eslint-plugin-depend'

export default [
  ...eslintPluginAstro.configs['flat/recommended'],
  ...eslintPluginSvelte.configs['flat/recommended'],
  depend.configs['flat/recommended'],
  {
    files: ['**/*.svelte', '**/*.svelte.ts', '**/*.svelte.js'],
    languageOptions: {
      parserOptions: { parser: tsParser, extraFileExtensions: ['.svelte'] }
    }
  },
  {
    files: ['**/*.ts'],
    languageOptions: { parser: tsParser }
  }
]

Full (defineConfig, a11y, prettier plugin disabled, globals)

import { defineConfig } from 'eslint/config'
import globals from 'globals'
import js from '@eslint/js'
import tseslint from 'typescript-eslint'
import astro from 'eslint-plugin-astro'
import svelte from 'eslint-plugin-svelte'
import prettier from 'eslint-plugin-prettier'

const tsParser = tseslint.parser
const astroParser = astro.parser

export default defineConfig([
  // defineConfig() flattens nested config arrays, so array presets (tseslint/astro configs.recommended) need no ... spread
  { languageOptions: { globals: { ...globals.browser, ...globals.node } } },
  js.configs.recommended,
  tseslint.configs.recommended,
  { plugins: { prettier }, rules: { 'prettier/prettier': 'off' } },
  {
    files: ['**/*.ts', '**/*.tsx'],
    rules: { '@typescript-eslint/no-unused-vars': ['warn', { varsIgnorePattern: '^_' }] }
  },
  astro.configs.recommended,
  astro.configs['jsx-a11y-recommended'],
  {
    files: ['**/*.astro'],
    languageOptions: {
      parser: astroParser,
      parserOptions: {
        parser: tsParser, extraFileExtensions: ['.astro'],
        sourceType: 'module', ecmaVersion: 'latest'
      }
    },
    rules: { 'no-undef': 'off', '@typescript-eslint/no-explicit-any': 'warn' }
  },
  svelte.configs.recommended,
  {
    files: ['**/*.svelte'],
    languageOptions: { parserOptions: { parser: tsParser } },
    rules: {
      'svelte/no-at-html-tags': 'off',
      '@typescript-eslint/no-unused-expressions': 'warn'
    }
  },
  // *.svelte.ts = TS runes modules, NOT SFCs
  // svelte-eslint-parser breaks on TS-only syntax like #field: Type
  {
    files: ['**/*.svelte.ts'],
    languageOptions: {
      parser: tsParser,
      parserOptions: { ecmaVersion: 'latest', sourceType: 'module' }
    }
  },
  { ignores: ['dist/**', '**/*.d.ts', '.github/'] }
])

Key: *.svelte.ts needs its own config block

Svelte 5 runes modules (*.svelte.ts, *.svelte.js) are pure TS/JS. svelte-eslint-parser breaks on TS-only syntax like private fields (#field: Type). Give them a separate block with tsParser directly.

Stylelint: config-recommended vs config-standard

Config What it includes
stylelint-config-recommended Error-prevention rules only (duplicate selectors, invalid values)
stylelint-config-standard Everything in recommended + stylistic conventions (hex length, shorthand, color notation)

standard requires more rule overrides to disable opinions you don't want. If you null out most stylistic rules, switch to recommended.

Resources

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts4mo3 checks · Risk SAFE
  • Gen Agent Trust Hub4mo

    This skill provides configuration advice and snippets for JavaScript toolchains such as ESLint, Prettier, Svelte, and Astro. It uses standard diagnostic commands and references well-known community packages.

  • Socket4mo

    No alerts

  • Snyk4mo

    Risk: LOW · No issues

Signed by skilld at a024d57. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last month.

Activeupdated 5 months ago
user-invocable
true

README badge

README badge for fubits1/svelte-skills/js-config