-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
688 additions
and
405 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
module.exports = { | ||
extends: [ | ||
'@singularit/eslint-config-vue' | ||
], | ||
extends: [ | ||
'@singularit/eslint-config-vue', | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,328 @@ | ||
module.exports = { | ||
env: { | ||
es6: true, | ||
browser: true, | ||
node: true, | ||
}, | ||
reportUnusedDisableDirectives: true, | ||
extends: [ | ||
'./standard', | ||
'plugin:import/recommended', | ||
'plugin:eslint-comments/recommended', | ||
'plugin:jsonc/recommended-with-jsonc', | ||
'plugin:yml/standard', | ||
'plugin:markdown/recommended', | ||
env: { | ||
es6: true, | ||
browser: true, | ||
node: true, | ||
}, | ||
reportUnusedDisableDirectives: true, | ||
extends: [ | ||
'./standard', | ||
'plugin:import/recommended', | ||
'plugin:eslint-comments/recommended', | ||
'plugin:jsonc/recommended-with-jsonc', | ||
'plugin:yml/standard', | ||
'plugin:markdown/recommended', | ||
], | ||
ignorePatterns: [ | ||
'*.min.*', | ||
'CHANGELOG.md', | ||
'dist', | ||
'LICENSE*', | ||
'output', | ||
'coverage', | ||
'public', | ||
'temp', | ||
'packages-lock.json', | ||
'pnpm-lock.yaml', | ||
'yarn.lock', | ||
'__snapshots__', | ||
'!.github', | ||
'!.vitepress', | ||
'!.vscode', | ||
], | ||
plugins: [ | ||
'html', | ||
'unicorn', | ||
], | ||
settings: { | ||
'import/resolver': { | ||
node: {extensions: ['.js', '.mjs']}, | ||
}, | ||
}, | ||
overrides: [ | ||
{ | ||
files: ['*.json', '*.json5'], | ||
parser: 'jsonc-eslint-parser', | ||
rules: { | ||
'jsonc/array-bracket-spacing': ['error', 'never'], | ||
'jsonc/comma-dangle': ['error', 'never'], | ||
'jsonc/comma-style': ['error', 'last'], | ||
'jsonc/indent': ['error', 2], | ||
'jsonc/key-spacing': ['error', {beforeColon: false, afterColon: true}], | ||
'jsonc/no-octal-escape': 'error', | ||
'jsonc/object-curly-newline': ['error', {multiline: true, consistent: true}], | ||
'jsonc/object-curly-spacing': ['error', 'never'], | ||
'jsonc/object-property-newline': ['error', {allowMultiplePropertiesPerLine: true}], | ||
}, | ||
}, | ||
{ | ||
files: ['package.json'], | ||
parser: 'jsonc-eslint-parser', | ||
rules: { | ||
'jsonc/sort-keys': [ | ||
'error', | ||
{ | ||
pathPattern: '^$', | ||
order: [ | ||
'publisher', | ||
'name', | ||
'displayName', | ||
'type', | ||
'version', | ||
'private', | ||
'packageManager', | ||
'description', | ||
'author', | ||
'license', | ||
'funding', | ||
'homepage', | ||
'repository', | ||
'bugs', | ||
'keywords', | ||
'categories', | ||
'sideEffects', | ||
'exports', | ||
'main', | ||
'module', | ||
'unpkg', | ||
'jsdelivr', | ||
'types', | ||
'typesVersions', | ||
'bin', | ||
'icon', | ||
'files', | ||
'engines', | ||
'activationEvents', | ||
'contributes', | ||
'scripts', | ||
'peerDependencies', | ||
'peerDependenciesMeta', | ||
'dependencies', | ||
'optionalDependencies', | ||
'devDependencies', | ||
'pnpm', | ||
'overrides', | ||
'resolutions', | ||
'husky', | ||
'simple-git-hooks', | ||
'lint-staged', | ||
'eslintConfig', | ||
], | ||
}, | ||
{ | ||
pathPattern: '^(?:dev|peer|optional|bundled)?[Dd]ependencies$', | ||
order: {type: 'asc'}, | ||
}, | ||
{ | ||
pathPattern: '^exports.*$', | ||
order: [ | ||
'types', | ||
'require', | ||
'import', | ||
], | ||
}, | ||
], | ||
}, | ||
}, | ||
{ | ||
files: ['*.yaml', '*.yml'], | ||
parser: 'yaml-eslint-parser', | ||
rules: { | ||
'spaced-comment': 'off', | ||
}, | ||
}, | ||
{ | ||
files: ['*.js'], | ||
rules: { | ||
'@typescript-eslint/no-var-requires': 'off', | ||
}, | ||
}, | ||
{ | ||
files: ['scripts/**/*.*', 'cli.*'], | ||
rules: { | ||
'no-console': 'off', | ||
}, | ||
}, | ||
{ | ||
files: ['*.test.ts', '*.test.js', '*.spec.ts', '*.spec.js', '*.cy.ts', '*.cy.js'], | ||
rules: { | ||
'no-unused-expressions': 'off', | ||
}, | ||
}, | ||
{ | ||
// Code blocks in markdown file | ||
files: ['**/*.md/*.*'], | ||
rules: { | ||
'@typescript-eslint/no-redeclare': 'off', | ||
'@typescript-eslint/no-unused-vars': 'off', | ||
'@typescript-eslint/no-use-before-define': 'off', | ||
'@typescript-eslint/no-var-requires': 'off', | ||
'@typescript-eslint/comma-dangle': 'off', | ||
'import/no-unresolved': 'off', | ||
'no-alert': 'off', | ||
'no-console': 'off', | ||
'no-restricted-imports': 'off', | ||
'no-undef': 'off', | ||
'no-unused-expressions': 'off', | ||
'no-unused-vars': 'off', | ||
}, | ||
}, | ||
], | ||
rules: { | ||
// import | ||
'import/order': 'error', | ||
'import/first': 'error', | ||
'import/no-mutable-exports': 'error', | ||
'import/no-unresolved': 'off', | ||
// 'import/no-absolute-path': 'off', | ||
|
||
// Common | ||
'semi': ['error', 'never'], | ||
'curly': ['error', 'multi-or-nest', 'consistent'], | ||
'quotes': ['error', 'single'], | ||
'quote-props': ['error', 'consistent-as-needed'], | ||
'no-unused-vars': 'warn', | ||
'no-param-reassign': 'off', | ||
'array-bracket-spacing': ['error', 'never'], | ||
'brace-style': ['error', 'stroustrup', {allowSingleLine: true}], | ||
'block-spacing': ['error', 'always'], | ||
'camelcase': ['warn', {ignoreImports: true}], // changed | ||
'comma-spacing': ['error', {before: false, after: true}], | ||
'comma-style': ['error', 'last'], | ||
'comma-dangle': ['error', 'always-multiline'], | ||
'no-constant-condition': 'warn', | ||
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off', // needs further analysis | ||
'no-console': ['error', {allow: ['warn', 'error']}], | ||
'no-cond-assign': ['error', 'always'], | ||
'func-call-spacing': ['off', 'never'], | ||
'key-spacing': ['error', {beforeColon: false, afterColon: true}], | ||
'indent': ['error', 2, {SwitchCase: 1, VariableDeclarator: 1, outerIIFEBody: 1}], | ||
'no-restricted-syntax': [ | ||
'error', | ||
'LabeledStatement', | ||
'WithStatement', | ||
], | ||
'object-curly-spacing': 'off', // | ||
'no-return-await': 'warn', // | ||
'space-before-function-paren': [ | ||
'error', | ||
{ | ||
anonymous: 'always', | ||
named: 'never', | ||
asyncArrow: 'always', | ||
}, | ||
], | ||
'no-multiple-empty-lines': ['error', {max: 1, maxBOF: 0, maxEOF: 1}], | ||
|
||
// es6 | ||
'no-var': 'error', | ||
'prefer-const': [ | ||
'error', | ||
{ | ||
destructuring: 'any', // need further analysis | ||
ignoreReadBeforeAssign: true, // | ||
}, | ||
], | ||
'prefer-arrow-callback': [ | ||
'error', | ||
{ | ||
allowNamedFunctions: false, | ||
allowUnboundThis: true, | ||
}, | ||
], | ||
ignorePatterns: [ | ||
'*.min.*', | ||
'CHANGELOG.md', | ||
'dist', | ||
'LICENSE*', | ||
'output', | ||
'coverage', | ||
'public', | ||
'temp', | ||
'packages-lock.json', | ||
'pnpm-lock.yaml', | ||
'yarn.lock', | ||
'__snapshots__', | ||
'!.github', | ||
'!.vitepress', | ||
'!.vscode', | ||
'object-shorthand': [ | ||
'error', | ||
'always', | ||
{ | ||
ignoreConstructors: false, | ||
avoidQuotes: true, | ||
}, | ||
], | ||
plugins: [ | ||
'html', | ||
'unicorn', | ||
'prefer-exponentiation-operator': 'error', | ||
'prefer-rest-params': 'error', | ||
'prefer-spread': 'error', | ||
'prefer-template': 'error', | ||
'template-curly-spacing': 'error', | ||
'arrow-parens': ['error', 'as-needed', {requireForBlockBody: true}], | ||
'generator-star-spacing': 'off', | ||
'spaced-comment': ['error', 'always', { | ||
line: { | ||
markers: ['/'], | ||
exceptions: ['/', '#'], | ||
}, | ||
block: { | ||
markers: ['!'], | ||
exceptions: ['*'], | ||
balanced: true, | ||
}, | ||
}], | ||
// best-practice | ||
'array-callback-return': 'error', | ||
'block-scoped-var': 'error', | ||
'consistent-return': 'off', | ||
'complexity': ['off', 11], | ||
'eqeqeq': ['error', 'smart'], | ||
'no-alert': 'warn', | ||
'no-case-declarations': 'error', | ||
'no-multi-spaces': 'error', | ||
'no-multi-str': 'error', | ||
'no-with': 'error', | ||
'no-void': 'error', | ||
'no-useless-escape': 'warn', | ||
'vars-on-top': 'error', | ||
'require-await': 'off', | ||
'no-return-assign': 'off', | ||
'operator-linebreak': ['error', 'before'], | ||
|
||
// unicorns | ||
// Pass error message when throwing errors | ||
'unicorn/error-message': 'error', | ||
// Uppercase regex escapes | ||
'unicorn/escape-case': 'error', | ||
// Array.isArray instead of instanceof | ||
'unicorn/no-instanceof-array': 'error', | ||
// Prevent deprecated `new Buffer()` | ||
'unicorn/no-new-buffer': 'error', | ||
// Keep regex literals safe! | ||
'unicorn/no-unsafe-regex': 'off', | ||
// Lowercase number formatting for octal, hex, binary (0x1'error' instead of 0X1'error') | ||
'unicorn/number-literal-case': 'error', | ||
// includes over indexOf when checking for existence | ||
'unicorn/prefer-includes': 'error', | ||
// String methods startsWith/endsWith instead of more complicated stuff | ||
'unicorn/prefer-starts-ends-with': 'error', | ||
// textContent instead of innerText | ||
'unicorn/prefer-text-content': 'error', | ||
// Enforce throwing type error when throwing error while checking typeof | ||
'unicorn/prefer-type-error': 'error', | ||
// Use new when throwing error | ||
'unicorn/throw-new-error': 'error', | ||
|
||
'no-use-before-define': ['error', {functions: false, classes: false, variables: true}], | ||
'eslint-comments/disable-enable-pair': 'off', | ||
'import/no-named-as-default-member': 'off', | ||
'import/no-named-as-default': 'off', | ||
'import/namespace': 'off', | ||
'n/no-callback-literal': 'off', | ||
|
||
'sort-imports': [ | ||
'error', | ||
{ | ||
ignoreCase: false, | ||
ignoreDeclarationSort: true, | ||
ignoreMemberSort: false, | ||
memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'], | ||
allowSeparatedGroups: false, | ||
}, | ||
], | ||
settings: { | ||
'import/resolver': { | ||
node: { extensions: ['.js', '.mjs'] }, | ||
}, | ||
}, | ||
overrides: [], | ||
rules: {}, | ||
} | ||
|
||
// yml | ||
'yml/quotes': ['error', {prefer: 'single', avoidEscape: false}], | ||
'yml/no-empty-document': 'off', | ||
|
||
// antfu | ||
// 'antfu/if-newline': 'error', | ||
// 'antfu/import-dedupe': 'error', | ||
// 'antfu/prefer-inline-type-import': 'error', | ||
}, | ||
} |
Oops, something went wrong.