chore: use @markedjs/eslint-config (#3391)

This commit is contained in:
Tony Brix 2024-08-05 15:41:23 -06:00 committed by GitHub
parent f7d5059e16
commit 8e7fe06eed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 416 additions and 589 deletions

View File

@ -1,232 +1,8 @@
import globals from 'globals';
import pluginN from 'eslint-plugin-n';
import tsEslint from 'typescript-eslint';
import stylistic from '@stylistic/eslint-plugin';
import markedEslintConfig from '@markedjs/eslint-config';
export default [
{
ignores: ['**/lib', '**/*.min.js', '**/public'],
},
...tsEslint.configs.recommended,
{
plugins: {
'@n': pluginN,
'@stylistic': stylistic,
},
languageOptions: {
ecmaVersion: 2024,
sourceType: 'module',
globals: {
...globals.es2024,
...globals.node,
...globals.browser,
document: 'readonly',
navigator: 'readonly',
window: 'readonly',
},
},
rules: {
'accessor-pairs': ['error', { setWithoutGet: true, enforceForClassMembers: true }],
'array-callback-return': ['error', {
allowImplicit: false,
checkForEach: false,
}],
'constructor-super': 'error',
curly: ['error', 'multi-line'],
'default-case-last': 'error',
'dot-notation': ['error', { allowKeywords: true }],
eqeqeq: ['error', 'always', { null: 'ignore' }],
'new-cap': ['error', { newIsCap: true, capIsNew: false, properties: true }],
'no-array-constructor': 'error',
'no-async-promise-executor': 'error',
'no-caller': 'error',
'no-case-declarations': 'error',
'no-class-assign': 'error',
'no-compare-neg-zero': 'error',
'no-const-assign': 'error',
'no-constant-condition': ['error', { checkLoops: false }],
'no-debugger': 'error',
'no-delete-var': 'error',
'no-dupe-args': 'error',
'no-dupe-keys': 'error',
'no-duplicate-case': 'error',
'no-useless-backreference': 'error',
'no-empty': ['error', { allowEmptyCatch: true }],
'no-empty-character-class': 'error',
'no-empty-pattern': 'error',
'no-eval': 'error',
'no-ex-assign': 'error',
'no-extend-native': 'error',
'no-extra-bind': 'error',
'no-extra-boolean-cast': 'error',
'no-fallthrough': 'error',
'no-func-assign': 'error',
'no-global-assign': 'error',
'no-implied-eval': 'error',
'no-import-assign': 'error',
'no-invalid-regexp': 'error',
'no-irregular-whitespace': 'error',
'no-iterator': 'error',
'no-labels': ['error', { allowLoop: false, allowSwitch: false }],
'no-lone-blocks': 'error',
'no-loss-of-precision': 'error',
'no-misleading-character-class': 'error',
'no-prototype-builtins': 'error',
'no-useless-catch': 'error',
'no-multi-str': 'error',
'no-new': 'error',
'no-new-func': 'error',
'no-new-object': 'error',
'no-new-symbol': 'error',
'no-new-wrappers': 'error',
'no-obj-calls': 'error',
'no-octal': 'error',
'no-octal-escape': 'error',
'no-proto': 'error',
'no-regex-spaces': 'error',
'no-return-assign': ['error', 'except-parens'],
'no-self-assign': ['error', { props: true }],
'no-self-compare': 'error',
'no-sequences': 'error',
'no-shadow-restricted-names': 'error',
'no-sparse-arrays': 'error',
'no-template-curly-in-string': 'error',
'no-this-before-super': 'error',
'no-throw-literal': 'error',
'no-undef': 'error',
'no-undef-init': 'error',
'no-unexpected-multiline': 'error',
'no-unmodified-loop-condition': 'error',
'no-unneeded-ternary': ['error', { defaultAssignment: false }],
'no-unreachable': 'error',
'no-unreachable-loop': 'error',
'no-unsafe-finally': 'error',
'no-unsafe-negation': 'error',
'no-unused-expressions': ['error', {
allowShortCircuit: true,
allowTernary: true,
allowTaggedTemplates: true,
}],
'no-unused-vars': ['error', {
args: 'none',
caughtErrors: 'none',
ignoreRestSiblings: true,
vars: 'all',
}],
'no-use-before-define': ['error', { functions: false, classes: false, variables: false }],
'no-useless-call': 'error',
'no-useless-computed-key': 'error',
'no-useless-constructor': 'error',
'no-useless-rename': 'error',
'no-useless-return': 'error',
'no-var': 'error',
'no-void': 'error',
'no-with': 'error',
'object-shorthand': ['warn', 'properties'],
'prefer-const': ['error', { destructuring: 'all' }],
'prefer-promise-reject-errors': 'error',
'prefer-regex-literals': ['error', { disallowRedundantWrapping: true }],
'symbol-description': 'error',
'unicode-bom': ['error', 'never'],
'use-isnan': ['error', {
enforceForSwitchCase: true,
enforceForIndexOf: true,
}],
'valid-typeof': ['error', { requireStringLiterals: true }],
yoda: ['error', 'never'],
'@stylistic/array-bracket-spacing': ['error', 'never'],
'@stylistic/arrow-spacing': ['error', { before: true, after: true }],
'@stylistic/block-spacing': ['error', 'always'],
'@stylistic/brace-style': ['error', '1tbs', { allowSingleLine: true }],
camelcase: ['error', {
allow: ['^UNSAFE_'],
properties: 'never',
ignoreGlobals: true,
}],
'@stylistic/comma-dangle': ['error', 'always-multiline'],
'@stylistic/comma-spacing': ['error', { before: false, after: true }],
'@stylistic/comma-style': ['error', 'last'],
'@stylistic/computed-property-spacing': ['error', 'never', { enforceForClassMembers: true }],
'@stylistic/dot-location': ['error', 'property'],
'@stylistic/eol-last': 'error',
'@stylistic/func-call-spacing': ['error', 'never'],
'@stylistic/generator-star-spacing': ['error', { before: true, after: true }],
'@stylistic/indent': ['error', 2, {
SwitchCase: 1,
VariableDeclarator: {
var: 2,
},
outerIIFEBody: 0,
}],
'@stylistic/key-spacing': ['error', { beforeColon: false, afterColon: true }],
'@stylistic/keyword-spacing': ['error', { before: true, after: true }],
'@stylistic/lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: true }],
'@stylistic/multiline-ternary': ['error', 'always-multiline'],
'@stylistic/new-parens': 'error',
'@stylistic/no-extra-semi': 'error',
'@stylistic/no-extra-parens': ['error', 'functions'],
'@stylistic/no-floating-decimal': 'error',
'@stylistic/no-mixed-operators': ['error', {
groups: [
['==', '!=', '===', '!==', '>', '>=', '<', '<='],
['&&', '||'],
['in', 'instanceof'],
],
allowSamePrecedence: true,
}],
'@stylistic/no-mixed-spaces-and-tabs': 'error',
'@stylistic/no-multi-spaces': 'error',
'@stylistic/no-multiple-empty-lines': ['error', { max: 1, maxBOF: 0, maxEOF: 0 }],
'@stylistic/no-tabs': 'error',
'@stylistic/no-trailing-spaces': 'error',
'@stylistic/no-whitespace-before-property': 'error',
'@stylistic/object-curly-newline': ['error', { multiline: true, consistent: true }],
'@stylistic/object-curly-spacing': ['error', 'always'],
'@stylistic/object-property-newline': ['error', { allowMultiplePropertiesPerLine: true }],
'@stylistic/operator-linebreak': ['error', 'before', {
overrides: {
'=': 'after',
},
}],
'@stylistic/padded-blocks': ['error', { blocks: 'never', switches: 'never', classes: 'never' }],
'@stylistic/quote-props': ['error', 'as-needed'],
'@stylistic/quotes': ['error', 'single', { avoidEscape: true, allowTemplateLiterals: false }],
'@stylistic/rest-spread-spacing': ['error', 'never'],
'@stylistic/semi': ['error', 'always'],
'@stylistic/semi-spacing': ['error', { before: false, after: true }],
'@stylistic/space-before-blocks': ['error', 'always'],
'@stylistic/space-before-function-paren': ['error', 'never'],
'@stylistic/space-in-parens': ['error', 'never'],
'@stylistic/space-infix-ops': 'error',
'@stylistic/space-unary-ops': ['error', { words: true, nonwords: false }],
'@stylistic/spaced-comment': ['error', 'always', {
line: { markers: ['*package', '!', '/', ',', '='] },
block: { balanced: true, markers: ['*package', '!', ',', ':', '::', 'flow-include'], exceptions: ['*'] },
}],
'@stylistic/template-curly-spacing': ['error', 'never'],
'@stylistic/template-tag-spacing': ['error', 'never'],
'@stylistic/wrap-iife': ['error', 'any', { functionPrototypeMethods: true }],
'@stylistic/yield-star-spacing': ['error', 'both'],
'@n/handle-callback-err': ['error', '^(err|error)$'],
'@n/no-callback-literal': 'error',
'@n/no-deprecated-api': 'error',
'@n/no-exports-assign': 'error',
'@n/no-new-require': 'error',
'@n/no-path-concat': 'error',
'@n/process-exit-as-throw': 'error',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/no-unused-vars': ['error', {
args: 'none',
}],
},
},
...markedEslintConfig,
];

770
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -54,6 +54,7 @@
],
"devDependencies": {
"@arethetypeswrong/cli": "^0.15.3",
"@markedjs/eslint-config": "^1.0.1",
"@markedjs/testutils": "13.0.1-0",
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^11.1.6",
@ -62,14 +63,11 @@
"@semantic-release/github": "^10.1.3",
"@semantic-release/npm": "^12.0.1",
"@semantic-release/release-notes-generator": "^14.0.1",
"@stylistic/eslint-plugin": "^2.3.0",
"cheerio": "1.0.0-rc.12",
"commonmark": "0.31.1",
"cross-env": "^7.0.3",
"dts-bundle-generator": "^9.5.1",
"eslint": "^9.8.0",
"eslint-plugin-n": "^17.10.1",
"globals": "^15.8.0",
"highlight.js": "^11.10.0",
"markdown-it": "14.1.0",
"marked-highlight": "^2.1.3",
@ -81,8 +79,7 @@
"titleize": "^4.0.0",
"ts-expect": "^1.3.0",
"tslib": "^2.6.3",
"typescript": "5.5.4",
"typescript-eslint": "8.0.0-alpha.51"
"typescript": "5.5.4"
},
"scripts": {
"bench": "npm run build && node test/bench.js",