UNPKG

eslint-config-aether

Version:

A custom code style for ESLint.

240 lines (236 loc) 6.44 kB
// src/index.ts import { defineConfig } from "eslint/config"; // src/base.ts import js from "@eslint/js"; import stylistic from "@stylistic/eslint-plugin"; import globals from "globals"; var base_default = { files: [ "**/*.js", "**/*.ts" ], plugins: { "@stylistic": stylistic, js }, languageOptions: { globals: { ...globals.browser, ...globals.es2026, ...globals.jquery, ...globals.node, ...globals.worker } }, extends: [ "js/recommended" ], rules: { "camelcase": "off", "consistent-return": "error", "curly": "warn", "dot-notation": "warn", "eqeqeq": "error", "new-cap": "error", "no-array-constructor": "error", "no-alert": "warn", "no-caller": "error", "no-console": "off", "no-constant-condition": "warn", "no-debugger": "warn", "no-else-return": "warn", "no-empty": "warn", "no-extend-native": "error", "no-extra-bind": "error", "no-iterator": "error", "no-labels": "error", "no-lone-blocks": "warn", "no-loop-func": "warn", "no-new": "error", "no-new-func": "error", "no-object-constructor": "error", "no-new-wrappers": "error", "no-undef-init": "warn", "no-underscore-dangle": ["warn", { "allowAfterThis": true }], "no-unused-vars": ["warn", { "vars": "all", "args": "none", "caughtErrors": "none" }], "no-var": "error", "prefer-const": "warn", "yoda": ["warn", "never"], "@stylistic/array-bracket-spacing": ["warn", "never"], "@stylistic/block-spacing": ["warn", "always"], "@stylistic/brace-style": ["warn", "1tbs", { "allowSingleLine": true }], "@stylistic/comma-dangle": ["warn", "never"], "@stylistic/comma-spacing": "warn", "@stylistic/comma-style": ["warn", "last"], "@stylistic/computed-property-spacing": ["warn", "never"], "@stylistic/eol-last": ["warn", "always"], "@stylistic/function-call-spacing": ["warn", "never"], "@stylistic/indent": ["warn", "tab", { "SwitchCase": 1 }], "@stylistic/key-spacing": "warn", "@stylistic/keyword-spacing": ["warn", { "overrides": { "catch": { "after": false }, "if": { "after": false }, "for": { "after": false }, "switch": { "after": false }, "while": { "after": false } } }], "@stylistic/lines-between-class-members": ["warn", "always", { "exceptAfterSingleLine": true }], "@stylistic/object-curly-spacing": ["warn", "always"], "@stylistic/max-len": ["warn", { "code": 120, "tabWidth": 2, "ignoreComments": true }], "@stylistic/member-delimiter-style": ["error"], "@stylistic/new-parens": "error", "@stylistic/no-extra-semi": "warn", "@stylistic/no-mixed-spaces-and-tabs": "warn", "@stylistic/no-multiple-empty-lines": ["warn", { "max": 1 }], "@stylistic/no-multi-spaces": "warn", "@stylistic/no-trailing-spaces": "warn", "@stylistic/no-whitespace-before-property": "warn", "@stylistic/padded-blocks": ["warn", "always", { "allowSingleLineBlocks": true }], "@stylistic/quotes": ["warn", "double"], "@stylistic/semi": ["error", "always"], "@stylistic/semi-spacing": "warn", "@stylistic/space-before-blocks": ["warn", "always"], "@stylistic/space-before-function-paren": ["warn", "never"], "@stylistic/space-in-parens": ["warn", "never"], "@stylistic/space-infix-ops": "warn", "@stylistic/space-unary-ops": "warn", "@stylistic/spaced-comment": ["warn", "always"], "@stylistic/type-generic-spacing": "warn", "@stylistic/wrap-iife": "warn" } }; // src/typechecked.ts import ts from "typescript-eslint"; var typechecked_default = { files: [ "**/*.ts" ], plugins: { "@typescript-eslint": ts.plugin }, languageOptions: { parser: ts.parser, parserOptions: { project: ["tsconfig.json"] } }, extends: [ "@typescript-eslint/recommended-type-checked", "@typescript-eslint/stylistic-type-checked" ], rules: { "no-undef": "off", "no-underscore-dangle": "off", "no-unused-vars": "off", "prefer-const": "warn", "@typescript-eslint/class-literal-property-style": "warn", "@typescript-eslint/dot-notation": "warn", "@typescript-eslint/naming-convention": [ "warn", { "selector": "default", "format": ["camelCase"] }, { "selector": ["import"], "format": ["camelCase", "PascalCase"] }, { "selector": ["variable", "accessor"], "format": ["camelCase", "UPPER_CASE"] }, { "selector": ["parameter", "property"], "format": ["camelCase"], "leadingUnderscore": "allow" }, { "selector": "classProperty", "modifiers": ["static", "readonly"], "format": ["camelCase", "PascalCase", "UPPER_CASE"], "leadingUnderscore": "forbid" }, { "selector": "typeLike", "format": ["PascalCase"] }, { "selector": "enumMember", "format": ["UPPER_CASE"] }, { "selector": ["objectLiteralProperty", "objectLiteralMethod"], "format": null }, { "selector": "interface", "format": ["PascalCase"], "custom": { "regex": "^I[A-Z]", "match": false } } ], "@typescript-eslint/no-empty-function": "off", "@typescript-eslint/no-floating-promises": ["error", { "allowForKnownSafeCalls": [ { "from": "package", "package": "node:test", "name": ["suite", "test"] } ] }], "@typescript-eslint/no-unnecessary-type-assertion": "warn", "@typescript-eslint/no-unused-vars": ["warn", { "vars": "all", "args": "none", "caughtErrors": "none" }], "@typescript-eslint/prefer-nullish-coalescing": "warn", "@typescript-eslint/prefer-optional-chain": "off", "@typescript-eslint/strict-boolean-expressions": ["error", { "allowNullableObject": false }] } }; // src/index.ts var eslintignore = { ignores: [ "**/build/**", "**/dist/**", "**/vendor/**", "**/lib/**", "**/libs/**" ] }; var index_default = defineConfig([ eslintignore, base_default, typechecked_default ]); export { index_default as default };