πŸ“… You're Invited: Meet the Socket team at RSAC (April 28 – May 1).RSVP β†’
Socket
Sign inDemoInstall
Socket

eslint-plugin-qwik

Package Overview
Dependencies
Maintainers
4
Versions
271
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-qwik

An Open-Source sub-framework designed with a focus on server-side-rendering, lazy-loading, and styling/animation.

1.13.0
latest
Source
npm
Version published
Weekly downloads
9K
-14.17%
Maintainers
4
Weekly downloads
Β 
Created
Source

eslint-plugin-qwik

Qwik comes with its own set of ESLint rules to help developers write better code.

Usage

Install the plugin:

npm add -D eslint-plugin-qwik
pnpm add -D eslint-plugin-qwik
yarn add -D eslint-plugin-qwik

eslint-plugin-qwik uses the tsc typechecker to type information. You must include the tsconfigRootDir in the parserOptions.

Configurations

// eslint.config.js
import js from '@eslint/js';
import globals from 'globals';
import tseslint from 'typescript-eslint';
import { qwikEslint9Plugin } from 'eslint-plugin-qwik';

export const qwikConfig = [
  js.configs.recommended,
  ...tseslint.configs.recommended,
  {
    languageOptions: {
      parserOptions: {
        projectService: true,
        tsconfigRootDir: import.meta.dirname,
      },
    },
  },
  {
    files: ['**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}'],
    languageOptions: {
      globals: {
        ...globals.serviceworker,
        ...globals.browser,
        ...globals.node,
      },
    },
  },
  ...qwikEslint9Plugin.configs.recommended,
  {
    ignores: ['node_modules/*', 'dist/*', 'server/*', 'tmp/*'],
  },
];

ignores must always be the last configuration in the array. Note that in shared configs, the ignores must be defined where the config is used, not in the shared config.

Legacy config (eslint < 9)

// .eslintrc.js
module.exports = {
  env: {
    browser: true,
    es2021: true,
    node: true,
  },
  extends: [
    'eslint:recommended',
    'plugin:@typescript-eslint/recommended',
    'plugin:qwik/recommended',
  ],
  parser: '@typescript-eslint/parser',
  parserOptions: {
    tsconfigRootDir: __dirname,
    project: ['./tsconfig.json'],
    ecmaVersion: 2021,
    sourceType: 'module',
    ecmaFeatures: {
      jsx: true,
    },
  },
  plugins: ['@typescript-eslint'],
};

To ignore files, you must use the .eslintignore file.

List of supported rules

  • Warn in 'recommended' ruleset β€” βœ”οΈ
  • Error in 'recommended' ruleset β€” βœ…
  • Warn in 'strict' ruleset β€” πŸ”’
  • Error in 'strict' ruleset β€” πŸ”
  • Typecheck β€” πŸ’­
RuleDescriptionRuleset
qwik/valid-lexical-scopeUsed the tsc typechecker to detect the capture of unserializable data in dollar ($) scopes.βœ… πŸ” πŸ’­
qwik/use-method-usageDetect invalid use of use hook.βœ… πŸ”
qwik/no-react-propsDisallow usage of React-specific className/htmlFor props.βœ… πŸ”
qwik/loader-locationDetect declaration location of loader$.βœ”οΈ πŸ”
qwik/prefer-classlistEnforce using the classlist prop over importing a classnames helper. The classlist prop accepts an object { [class: string]: boolean } just like classnames.βœ”οΈ πŸ”
qwik/jsx-no-script-urlDisallow javascript: URLs.βœ”οΈ πŸ”
qwik/jsx-keyDisallow missing key props in iterators/collection literals.βœ”οΈ πŸ”
qwik/unused-serverDetect unused server$() functions.βœ… πŸ”
qwik/jsx-imgFor performance reasons, always provide width and height attributes for <img> elements, it will help to prevent layout shifts.βœ”οΈ πŸ”
qwik/jsx-aFor a perfect SEO score, always provide href attribute for <a> elements.βœ”οΈ πŸ”
qwik/no-use-visible-taskDetect useVisibleTask$() functions.βœ”οΈ πŸ”’

Keywords

builder.io

FAQs

Package last updated on 01 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts