Skip to content
Draft
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
19 changes: 0 additions & 19 deletions .eslintrc.js

This file was deleted.

14 changes: 9 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"[javascript]": {
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
},
// This makes sure we use the system version of node, not the vs code version
"eslint.runtime": "node",
"eslint.useFlatConfig": true,
"typescript.tsdk": "node_modules\\typescript\\lib",
"[javascript]": {
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
}
},
}
22 changes: 22 additions & 0 deletions eslint.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import globals from "globals";
import tsEslint from "typescript-eslint";

import eslintPluginRezStream from "./lib";

export default tsEslint.config(
eslintPluginRezStream.configs.recommended,
{
languageOptions: {
globals: {
...globals.es2025,
...globals.node,
},
},
},
{
files: ["**/*.ts"],
extends: [
eslintPluginRezStream.configs.typescript,
],
},
);
5 changes: 5 additions & 0 deletions lib/configs/base.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type { Linter } from "eslint";

declare const Config: Linter.Config;

export default Config;
220 changes: 220 additions & 0 deletions lib/configs/base.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,220 @@
import js from "@eslint/js";
import stylistic from "@stylistic/eslint-plugin";

/** @type{import("eslint").Linter.Config} */
export default [
stylistic.configs.customize({
commaDangle: "always-multiline",
indent: 2,
quotes: "double",
semi: true,
arrowParens: "always",
}),
{
name: "rezstream-eslint/base",
rules: {
...js.configs.recommended.rules,
"array-bracket-spacing": ["error", "never"],
"arrow-body-style": ["error", "as-needed"],

// "arrow-parens": ["error", "always"],

"arrow-spacing": ["error", {
before: true,
after: true,
}],
"class-methods-use-this": "error",

// "comma-dangle": ["error", "always-multiline"],

"comma-spacing": [
"error",
{
before: false,
after: true,
},
],
"computed-property-spacing": ["error", "never"],
eqeqeq: ["error", "smart"],

// "eol-last": [
// "error",
// "always",
// ],

"function-call-argument-newline": ["error", "consistent"],
"function-paren-newline": ["error", "consistent"],
"implicit-arrow-linebreak": ["error", "beside"],

// indent: ["error",
// 2,
// { SwitchCase: 1 },
// ],
// "key-spacing": ["error", {
// beforeColon: false,
// afterColon: true,
// mode: "strict",
// }],
// "keyword-spacing": [
// "error",
// {
// before: true,
// after: true,
// },
// ],

"lines-between-class-members": ["error", "always"],
"line-comment-position": "error",
"linebreak-style": ["error", "unix"],
"max-statements-per-line": ["error", { max: 1 }],
"multiline-ternary": ["error", "always-multiline"],
"newline-per-chained-call": "error",
"no-bitwise": [
"error",
{ int32Hint: true },
],
"no-console": "error",
"no-constructor-return": "error",
"no-duplicate-imports": ["error", { includeExports: true }],
"no-else-return": "error",
"no-eval": "error",
"no-implied-eval": "error",

// "no-multi-spaces": "error",

"no-multiple-empty-lines": ["error", { max: 1 }],
"no-plusplus": ["error", { allowForLoopAfterthoughts: true }],
"no-return-assign": "error",
"no-self-compare": "error",
"no-template-curly-in-string": "error",
"no-trailing-spaces": "error",
"no-undef": "error",
"no-unmodified-loop-condition": "error",
"no-unreachable-loop": "error",
"no-unused-expressions": ["error", {
allowShortCircuit: false,
allowTernary: false,
allowTaggedTemplates: false,
}],
"no-unused-private-class-members": "error",
"no-unused-vars": ["error", {
args: "after-used",
argsIgnorePattern: "^_",
caughtErrors: "all",
ignoreRestSiblings: false,
reportUsedIgnorePattern: false,
vars: "all",
}],
"no-use-before-define": ["error", {
classes: false,
functions: false,
variables: true,
}],
"no-useless-constructor": "error",
"no-useless-return": "error",
"no-var": "error",
"no-whitespace-before-property": "error",

// "object-curly-spacing": ["error", "always"],

"object-shorthand": "error",
"one-var-declaration-per-line": "error",
"padding-line-between-statements": [
"error",
{
blankLine: "always",
prev: "*",
next: "return",
},
],
"prefer-arrow-callback": "error",
"prefer-const": "error",
radix: [
"error",
"always",
],
"require-await": "error",
"sort-imports": ["error", {
allowSeparatedGroups: true,
ignoreDeclarationSort: true,
}],
"sort-keys": ["off", "asc", {
caseSensitive: false, natural: true,
}],
"sort-vars": "error",
"space-before-blocks": ["error", "always"],
"space-before-function-paren": [
"error",
{
anonymous: "always",
asyncArrow: "always",
named: "never",
},
],
"space-in-parens": [
"error",
"never",
],
"space-infix-ops": [
"error",
{ int32Hint: true },
],
"space-unary-ops": [
"error",
{
words: true,
nonwords: false,
},
],
"spaced-comment": [
"error",
"always",
{
line: {
markers: [
"/",
],
},
},
],

// "unicode-bom": [
// "error",
// "never",
// ],

"@stylistic/lines-around-comment": ["error", {
beforeBlockComment: true,
afterBlockComment: false,
beforeLineComment: true,
afterLineComment: false,
allowBlockStart: true,
allowBlockEnd: false,
allowObjectStart: true,
allowObjectEnd: false,
allowArrayStart: true,
allowArrayEnd: false,
allowClassStart: true,
allowClassEnd: false,
applyDefaultIgnorePatterns: true,
afterHashbangComment: true,
}],
"@stylistic/object-curly-newline": ["error", {
ExportDeclaration: {
multiline: true,
minProperties: 2,
},
ImportDeclaration: {
multiline: true,
minProperties: 2,
},
ObjectExpression: {
multiline: true,
minProperties: 2,
},
ObjectPattern: { consistent: true },
}],
"@stylistic/quote-props": ["error", "as-needed"],
},
},
];
5 changes: 5 additions & 0 deletions lib/configs/browser.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type { Linter } from "eslint";

declare const Config: Linter.Config[];

export default Config;
35 changes: 10 additions & 25 deletions lib/configs/browser.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,13 @@
import eslintPluginWc from "eslint-plugin-wc";
import globals from "globals";

/** @type{import("eslint").Linter.Config} */
const config = {
env: {
browser: true,
},
extends: [
"plugin:wc/best-practice",
],
plugins: [
"wc",
],
rules: {
"no-console": ["error",
{
allow: ["warn", "error"],
},
],
},
settings: {
"import/resolver": {
node: {
extensions: [".js", ".cjs", ".mjs", ".ts"],
},
export default [
eslintPluginWc.configs["flat/best-practice"],
{
languageOptions: { globals: { ...globals.browser } },
rules: {
"no-console": ["error", { allow: ["warn", "error"] }],
},
},
};

module.exports = config;
];
5 changes: 5 additions & 0 deletions lib/configs/recommended.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type { Linter } from "eslint";

declare const Config: Linter.Config[];

export default Config;
Loading
Loading