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
69 changes: 69 additions & 0 deletions examples/eslint-v9/eslint.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import js from '@eslint/js';
// @ts-expect-error - Could not find a declaration file for module '@shopify/eslint-plugin'.
import shopifyEslintPlugin from '@shopify/eslint-plugin';
import tsParser from '@typescript-eslint/parser';
import tseslint from 'typescript-eslint';
import { defineConfig } from 'eslint/config';
import wyrm from 'eslint-plugin-wyrm';
import * as sonarjs from 'eslint-plugin-sonarjs';
import eslintPluginUnicorn from 'eslint-plugin-unicorn';
import type { Plugin } from '@eslint/core';

export default defineConfig([
{
files: ['**/*.{js,mjs,cjs,ts,mts,cts}'],
extends: [
js.configs.recommended,
tseslint.configs.strictTypeChecked,
tseslint.configs.stylisticTypeChecked,
],
languageOptions: {
parser: tsParser,
ecmaVersion: 'latest',
sourceType: 'module',
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
linterOptions: {
reportUnusedDisableDirectives: 'error',
reportUnusedInlineConfigs: 'error',
},
},

{
plugins: { shopify: shopifyEslintPlugin as Plugin },
},

sonarjs.configs.recommended,
eslintPluginUnicorn.configs.recommended,

// ...shopifyEslintPlugin.configs.esnext,
// ...shopifyEslintPlugin.configs.typescript,
// ...shopifyEslintPlugin.configs['typescript-type-checking'],

{
rules: {
'no-else-return': ['error', { allowElseIf: false }],
'no-lone-blocks': 'error',

'unicorn/prevent-abbreviations': 'off',
'unicorn/no-useless-undefined': 'off',
'unicorn/throw-new-error': 'off',
'unicorn/new-for-builtins': 'off',
'unicorn/no-null': 'off',
'unicorn/no-negated-condition': 'off',
'unicorn/no-array-reduce': 'off',
'unicorn/prefer-spread': 'off',

'sonarjs/deprecation': 'off',

'shopify/prefer-early-return': 'error',

'@typescript-eslint/array-type': ['error', { default: 'array-simple' }],
},
},

wyrm.configs.strictTypeChecked,
]);
26 changes: 26 additions & 0 deletions examples/eslint-v9/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "@eslint-plugin-wyrm/eslint-v9",
"version": "0.0.0",
"private": true,
"description": "Example for eslint@9 with eslint-plugin-wyrm",
"type": "module",
"main": "src/index.ts",
"scripts": {
"fix:format": "prettier --write .",
"lint:format": "prettier --check .",
"lint:js": "eslint ."
},
"devDependencies": {
"@eslint/core": "^1.1.1",
"@eslint/js": "npm:@eslint/js@9.39.2",
"@shopify/eslint-plugin": "^50.0.0",
"@typescript-eslint/parser": "^8.56.1",
"eslint": "npm:eslint@9.39.2",
"eslint-plugin-sonarjs": "^4.0.0",
"eslint-plugin-unicorn": "^63.0.0",
"eslint-plugin-wyrm": "workspace:*",
"jiti": "^2.6.1",
"prettier": "^3.8.1",
"typescript-eslint": "^8.56.1"
}
}
1 change: 1 addition & 0 deletions examples/eslint-v9/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './rules/distribute-boolean-casts.js';
17 changes: 17 additions & 0 deletions examples/eslint-v9/src/rules/distribute-boolean-casts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
interface Bar {
isOpen: boolean;
tables: number[];
}

interface Foo {
description: string;
}

export function distributeBooleanCast(
bar: Bar | undefined,
foo?: Foo,
defaultDescription?: string,
): boolean {
// eslint-disable-next-line wyrm/distribute-boolean-casts
return !!(bar && bar.tables.length > 42 && (foo?.description ?? defaultDescription));
}
28 changes: 28 additions & 0 deletions examples/eslint-v9/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"compilerOptions": {
"noEmit": true,

"module": "nodenext",
"target": "esnext",
"lib": ["esnext"],

"allowJs": true,
"checkJs": true,

"verbatimModuleSyntax": true,
"isolatedModules": true,
"moduleDetection": "force",
"skipLibCheck": true,

"noUncheckedSideEffectImports": true,
"noUncheckedIndexedAccess": true,
"exactOptionalPropertyTypes": true,
"noImplicitReturns": true,
"noImplicitOverride": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"noPropertyAccessFromIndexSignature": true,
"strict": true
}
}
1 change: 0 additions & 1 deletion examples/example-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"globals": "^17.4.0",
"jiti": "^2.6.1",
"prettier": "^3.8.1",
"rolldown-vite": "^7.3.1",
"typescript": "~5.9.3",
"typescript-eslint": "^8.56.1",
"vite": "^8.0.0"
Expand Down
Loading
Loading