ESLint plugin providing comprehensive linting rules specifically designed for the Qwik framework with performance-focused development patterns
npx @tessl/cli install tessl/npm-eslint-plugin-qwik@1.16.0ESLint Plugin Qwik provides comprehensive linting rules specifically designed for the Qwik framework. It includes 11 specialized rules that help developers write better Qwik code by detecting improper use of framework-specific patterns, enforcing best practices for component development, and preventing common performance pitfalls.
npm install -D eslint-plugin-qwikimport { qwikEslint9Plugin } from 'eslint-plugin-qwik';// In extends array
'plugin:qwik/recommended'// 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 = tseslint.config(
js.configs.recommended,
tseslint.configs.recommended,
qwikEslint9Plugin.configs.recommended,
{
files: ['**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}'],
languageOptions: {
globals: {
...globals.serviceworker,
...globals.browser,
...globals.node,
},
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
}
);// .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'],
};ESLint Plugin Qwik is built around several key components:
valid-lexical-scope ruleCore plugin exports for configuring ESLint with Qwik-specific rules and recommended settings.
// Main plugin exports
export const rules: Rules;
export const configs: Record<string, TSESLint.ClassicConfig.Config>;
export const qwikEslint9Plugin: {
configs: {
recommended: TSESLint.FlatConfig.ConfigArray;
strict: TSESLint.FlatConfig.ConfigArray;
};
meta: {
name: string;
version: string;
};
rules: Rules;
};
// Legacy configurations
interface Rules {
'valid-lexical-scope': Rule;
'use-method-usage': Rule;
'no-react-props': Rule;
'loader-location': Rule;
'prefer-classlist': Rule;
'jsx-no-script-url': Rule;
'jsx-key': Rule;
'unused-server': Rule;
'jsx-img': Rule;
'jsx-a': Rule;
'no-use-visible-task': Rule;
}Essential rules for Qwik framework patterns including dollar functions, hooks, and serialization validation.
// Type-aware lexical scope validation
validLexicalScope: Rule<[{ allowAny?: boolean }]>;
// Hook usage validation
useMethodUsage: Rule;
// Server function usage
unusedServer: Rule;Rules specifically for JSX patterns, React compatibility, and component best practices in Qwik.
// React compatibility
noReactProps: Rule;
// JSX best practices
jsxKey: Rule;
jsxImg: Rule;
jsxAtag: Rule;
jsxNoScriptUrl: Rule;Rules for enforcing Qwik-specific code quality patterns and performance optimizations.
// Qwik-specific patterns
preferClasslist: Rule;
loaderLocation: Rule;
noUseVisibleTask: Rule;valid-lexical-scope, use-method-usage, no-react-props, unused-serverno-use-visible-taskno-use-visible-task// ESLint rule type from @typescript-eslint/utils
type Rule = TSESLint.RuleModule<any, any>;
// Plugin rule collection
type Rules = NonNullable<TSESLint.FlatConfig.Plugin['rules']>;
// Legacy config type
interface Config extends TSESLint.ClassicConfig.Config {
plugins: string[];
rules: TSESLint.FlatConfig.Rules;
}