mirror of
https://github.com/theoludwig/eslint-config-conventions.git
synced 2024-11-08 19:11:31 +01:00
chore: initial commit
This commit is contained in:
commit
b79a5fbcb0
1
.commitlintrc.json
Normal file
1
.commitlintrc.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
{ "extends": ["@commitlint/config-conventional"] }
|
11
.editorconfig
Normal file
11
.editorconfig
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# For more information see: https://editorconfig.org/
|
||||||
|
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
end_of_line = lf
|
||||||
|
charset = utf-8
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
2
.eslintignore
Normal file
2
.eslintignore
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
node_modules
|
||||||
|
test/fixtures
|
318
.eslintrc.json
Normal file
318
.eslintrc.json
Normal file
@ -0,0 +1,318 @@
|
|||||||
|
{
|
||||||
|
"root": true,
|
||||||
|
"plugins": ["@typescript-eslint", "import", "promise", "unicorn"],
|
||||||
|
"env": {
|
||||||
|
"browser": true,
|
||||||
|
"node": true,
|
||||||
|
"es2022": true
|
||||||
|
},
|
||||||
|
"parser": "@typescript-eslint/parser",
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": 2022,
|
||||||
|
"sourceType": "module",
|
||||||
|
"ecmaFeatures": {
|
||||||
|
"jsx": true
|
||||||
|
},
|
||||||
|
"project": "./tsconfig.json"
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"constructor-super": "error",
|
||||||
|
"for-direction": "error",
|
||||||
|
"getter-return": "error",
|
||||||
|
"no-async-promise-executor": "error",
|
||||||
|
"no-class-assign": "error",
|
||||||
|
"no-compare-neg-zero": "error",
|
||||||
|
"no-cond-assign": "error",
|
||||||
|
"no-const-assign": "error",
|
||||||
|
"no-constant-condition": "error",
|
||||||
|
"no-constructor-return": "error",
|
||||||
|
"no-control-regex": "error",
|
||||||
|
"no-debugger": "error",
|
||||||
|
"no-dupe-args": "error",
|
||||||
|
"no-dupe-class-members": "off",
|
||||||
|
"@typescript-eslint/no-dupe-class-members": "error",
|
||||||
|
"no-dupe-else-if": "error",
|
||||||
|
"no-dupe-keys": "error",
|
||||||
|
"no-duplicate-case": "error",
|
||||||
|
"no-duplicate-imports": "off",
|
||||||
|
"@typescript-eslint/no-duplicate-imports": "error",
|
||||||
|
"no-empty-character-class": "error",
|
||||||
|
"no-empty-pattern": "error",
|
||||||
|
"no-ex-assign": "error",
|
||||||
|
"no-fallthrough": "error",
|
||||||
|
"no-func-assign": "error",
|
||||||
|
"no-import-assign": "error",
|
||||||
|
"no-invalid-regexp": "error",
|
||||||
|
"no-irregular-whitespace": "error",
|
||||||
|
"no-loss-of-precision": "off",
|
||||||
|
"@typescript-eslint/no-loss-of-precision": "error",
|
||||||
|
"no-misleading-character-class": "error",
|
||||||
|
"no-new-symbol": "error",
|
||||||
|
"no-obj-calls": "error",
|
||||||
|
"no-promise-executor-return": "error",
|
||||||
|
"no-prototype-builtins": "error",
|
||||||
|
"no-self-assign": "error",
|
||||||
|
"no-self-compare": "error",
|
||||||
|
"no-setter-return": "error",
|
||||||
|
"no-this-before-super": "error",
|
||||||
|
"no-undef": "error",
|
||||||
|
"no-unexpected-multiline": "error",
|
||||||
|
"no-unmodified-loop-condition": "error",
|
||||||
|
"no-unreachable": "error",
|
||||||
|
"no-unreachable-loop": "error",
|
||||||
|
"no-unsafe-finally": "error",
|
||||||
|
"no-unsafe-negation": "error",
|
||||||
|
"no-unsafe-optional-chaining": "error",
|
||||||
|
"no-unused-private-class-members": "error",
|
||||||
|
"no-unused-vars": "off",
|
||||||
|
"@typescript-eslint/no-unused-vars": "error",
|
||||||
|
"no-use-before-define": "off",
|
||||||
|
"@typescript-eslint/no-use-before-define": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"functions": false,
|
||||||
|
"classes": false,
|
||||||
|
"enums": false,
|
||||||
|
"variables": false,
|
||||||
|
"typedefs": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"no-useless-backreference": "error",
|
||||||
|
"require-atomic-updates": "error",
|
||||||
|
"use-isnan": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"enforceForSwitchCase": true,
|
||||||
|
"enforceForIndexOf": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"valid-typeof": ["error", { "requireStringLiterals": true }],
|
||||||
|
|
||||||
|
"class-methods-use-this": "error",
|
||||||
|
"consistent-this": "error",
|
||||||
|
"default-param-last": "off",
|
||||||
|
"@typescript-eslint/default-param-last": "error",
|
||||||
|
"default-case-last": "error",
|
||||||
|
"dot-notation": "off",
|
||||||
|
"@typescript-eslint/dot-notation": ["error", { "allowKeywords": true }],
|
||||||
|
"eqeqeq": "error",
|
||||||
|
"grouped-accessor-pairs": "error",
|
||||||
|
"new-cap": [
|
||||||
|
"error",
|
||||||
|
{ "newIsCap": true, "capIsNew": false, "properties": true }
|
||||||
|
],
|
||||||
|
"no-array-constructor": "off",
|
||||||
|
"@typescript-eslint/no-array-constructor": "error",
|
||||||
|
"no-caller": "error",
|
||||||
|
"no-confusing-arrow": "error",
|
||||||
|
"no-delete-var": "error",
|
||||||
|
"no-empty": ["error", { "allowEmptyCatch": true }],
|
||||||
|
"no-eval": "error",
|
||||||
|
"no-floating-decimal": "error",
|
||||||
|
"no-global-assign": "error",
|
||||||
|
"no-implied-eval": "off",
|
||||||
|
"@typescript-eslint/no-implied-eval": "error",
|
||||||
|
"no-mixed-operators": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"groups": [
|
||||||
|
["==", "!=", "===", "!==", ">", ">=", "<", "<="],
|
||||||
|
["&&", "||"],
|
||||||
|
["in", "instanceof"]
|
||||||
|
],
|
||||||
|
"allowSamePrecedence": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"no-multi-str": "error",
|
||||||
|
"no-new-func": "error",
|
||||||
|
"no-new-object": "error",
|
||||||
|
"no-octal": "error",
|
||||||
|
"no-octal-escape": "error",
|
||||||
|
"no-proto": "error",
|
||||||
|
"no-redeclare": "off",
|
||||||
|
"@typescript-eslint/no-redeclare": ["error", { "builtinGlobals": false }],
|
||||||
|
"no-regex-spaces": "error",
|
||||||
|
"no-shadow-restricted-names": "error",
|
||||||
|
"no-throw-literal": "off",
|
||||||
|
"@typescript-eslint/no-throw-literal": "error",
|
||||||
|
"no-undef-init": "error",
|
||||||
|
"no-unused-expressions": "off",
|
||||||
|
"@typescript-eslint/no-unused-expressions": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"allowShortCircuit": true,
|
||||||
|
"allowTernary": true,
|
||||||
|
"allowTaggedTemplates": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"no-useless-call": "error",
|
||||||
|
"no-useless-computed-key": "error",
|
||||||
|
"no-useless-constructor": "off",
|
||||||
|
"@typescript-eslint/no-useless-constructor": "error",
|
||||||
|
"no-useless-escape": "error",
|
||||||
|
"no-useless-rename": "error",
|
||||||
|
"no-useless-return": "error",
|
||||||
|
"no-var": "error",
|
||||||
|
"no-void": "error",
|
||||||
|
"no-with": "error",
|
||||||
|
"object-shorthand": ["error", "properties"],
|
||||||
|
"one-var": ["error", { "initialized": "never" }],
|
||||||
|
"prefer-const": ["error", { "destructuring": "all" }],
|
||||||
|
"prefer-object-has-own": "error",
|
||||||
|
"prefer-promise-reject-errors": "error",
|
||||||
|
"prefer-regex-literals": ["error", { "disallowRedundantWrapping": true }],
|
||||||
|
"quote-props": ["error", "as-needed"],
|
||||||
|
"radix": "error",
|
||||||
|
"require-await": "off",
|
||||||
|
"@typescript-eslint/require-await": "error",
|
||||||
|
"spaced-comment": ["error", "always"],
|
||||||
|
"yoda": ["error", "never"],
|
||||||
|
|
||||||
|
"import/no-absolute-path": "error",
|
||||||
|
"import/no-webpack-loader-syntax": "error",
|
||||||
|
"import/no-self-import": "error",
|
||||||
|
"import/no-useless-path-segments": "error",
|
||||||
|
"import/export": "error",
|
||||||
|
"import/first": "error",
|
||||||
|
"import/no-duplicates": "error",
|
||||||
|
"import/order": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"groups": ["builtin", "external", "internal"],
|
||||||
|
"newlines-between": "always"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"import/no-named-default": "error",
|
||||||
|
|
||||||
|
"promise/param-names": "error",
|
||||||
|
"promise/no-new-statics": "error",
|
||||||
|
|
||||||
|
"unicorn/better-regex": "error",
|
||||||
|
"unicorn/catch-error-name": "error",
|
||||||
|
"unicorn/custom-error-definition": "error",
|
||||||
|
"unicorn/error-message": "error",
|
||||||
|
"unicorn/escape-case": "error",
|
||||||
|
"unicorn/new-for-builtins": "error",
|
||||||
|
"unicorn/no-array-callback-reference": "error",
|
||||||
|
"unicorn/no-hex-escape": "error",
|
||||||
|
"unicorn/no-instanceof-array": "error",
|
||||||
|
"unicorn/no-this-assignment": "error",
|
||||||
|
"unicorn/no-zero-fractions": "error",
|
||||||
|
"unicorn/prefer-node-protocol": "error",
|
||||||
|
"unicorn/throw-new-error": "error"
|
||||||
|
},
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"files": ["*.ts", "*.tsx"],
|
||||||
|
"rules": {
|
||||||
|
"@typescript-eslint/adjacent-overload-signatures": "error",
|
||||||
|
"@typescript-eslint/array-type": [
|
||||||
|
"error",
|
||||||
|
{ "default": "array-simple" }
|
||||||
|
],
|
||||||
|
"@typescript-eslint/consistent-type-assertions": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"assertionStyle": "as",
|
||||||
|
"objectLiteralTypeAssertions": "never"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@typescript-eslint/consistent-type-definitions": [
|
||||||
|
"error",
|
||||||
|
"interface"
|
||||||
|
],
|
||||||
|
"@typescript-eslint/explicit-function-return-type": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"allowExpressions": true,
|
||||||
|
"allowHigherOrderFunctions": true,
|
||||||
|
"allowTypedFunctionExpressions": true,
|
||||||
|
"allowDirectConstAssertionInArrowFunctions": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@typescript-eslint/member-delimiter-style": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"multiline": { "delimiter": "none" },
|
||||||
|
"singleline": { "delimiter": "comma", "requireLast": false }
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@typescript-eslint/method-signature-style": "error",
|
||||||
|
"@typescript-eslint/naming-convention": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"selector": "variableLike",
|
||||||
|
"leadingUnderscore": "allow",
|
||||||
|
"trailingUnderscore": "allow",
|
||||||
|
"format": ["camelCase", "PascalCase", "UPPER_CASE"]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@typescript-eslint/no-base-to-string": "error",
|
||||||
|
"@typescript-eslint/no-dynamic-delete": "error",
|
||||||
|
"@typescript-eslint/no-empty-interface": [
|
||||||
|
"error",
|
||||||
|
{ "allowSingleExtends": true }
|
||||||
|
],
|
||||||
|
"@typescript-eslint/no-extra-non-null-assertion": "error",
|
||||||
|
"@typescript-eslint/no-extraneous-class": [
|
||||||
|
"error",
|
||||||
|
{ "allowWithDecorator": true }
|
||||||
|
],
|
||||||
|
"@typescript-eslint/no-floating-promises": "error",
|
||||||
|
"@typescript-eslint/no-for-in-array": "error",
|
||||||
|
"@typescript-eslint/no-invalid-void-type": "error",
|
||||||
|
"@typescript-eslint/no-misused-new": "error",
|
||||||
|
"@typescript-eslint/no-misused-promises": "error",
|
||||||
|
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
|
||||||
|
"@typescript-eslint/no-non-null-assertion": "error",
|
||||||
|
"@typescript-eslint/no-this-alias": [
|
||||||
|
"error",
|
||||||
|
{ "allowDestructuring": true }
|
||||||
|
],
|
||||||
|
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "error",
|
||||||
|
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
||||||
|
"@typescript-eslint/no-var-requires": "error",
|
||||||
|
"@typescript-eslint/prefer-function-type": "error",
|
||||||
|
"@typescript-eslint/prefer-includes": "error",
|
||||||
|
"@typescript-eslint/prefer-nullish-coalescing": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"ignoreConditionalTests": false,
|
||||||
|
"ignoreMixedLogicalExpressions": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@typescript-eslint/prefer-optional-chain": "error",
|
||||||
|
"@typescript-eslint/prefer-readonly": "error",
|
||||||
|
"@typescript-eslint/prefer-reduce-type-parameter": "error",
|
||||||
|
"@typescript-eslint/prefer-ts-expect-error": "error",
|
||||||
|
"@typescript-eslint/promise-function-async": "error",
|
||||||
|
"@typescript-eslint/require-array-sort-compare": [
|
||||||
|
"error",
|
||||||
|
{ "ignoreStringArrays": true }
|
||||||
|
],
|
||||||
|
"@typescript-eslint/restrict-plus-operands": [
|
||||||
|
"error",
|
||||||
|
{ "checkCompoundAssignments": true }
|
||||||
|
],
|
||||||
|
"@typescript-eslint/restrict-template-expressions": [
|
||||||
|
"error",
|
||||||
|
{ "allowNumber": true }
|
||||||
|
],
|
||||||
|
"@typescript-eslint/return-await": ["error", "always"],
|
||||||
|
"@typescript-eslint/strict-boolean-expressions": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
"allowString": false,
|
||||||
|
"allowNumber": false,
|
||||||
|
"allowNullableObject": false,
|
||||||
|
"allowNullableBoolean": false,
|
||||||
|
"allowNullableString": false,
|
||||||
|
"allowNullableNumber": false,
|
||||||
|
"allowAny": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@typescript-eslint/type-annotation-spacing": "error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
* text=auto eol=lf
|
20
.github/ISSUE_TEMPLATE/BUG.md
vendored
Normal file
20
.github/ISSUE_TEMPLATE/BUG.md
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
name: '🐛 Bug Report'
|
||||||
|
about: 'Report an unexpected problem or unintended behavior.'
|
||||||
|
title: '[Bug]'
|
||||||
|
labels: 'bug'
|
||||||
|
---
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Please provide a clear and concise description of what the bug is. Include
|
||||||
|
screenshots if needed. Please make sure your issue has not already been fixed.
|
||||||
|
-->
|
||||||
|
|
||||||
|
## Steps To Reproduce
|
||||||
|
|
||||||
|
1. Step 1
|
||||||
|
2. Step 2
|
||||||
|
|
||||||
|
## The current behavior
|
||||||
|
|
||||||
|
## The expected behavior
|
18
.github/ISSUE_TEMPLATE/DOCUMENTATION.md
vendored
Normal file
18
.github/ISSUE_TEMPLATE/DOCUMENTATION.md
vendored
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
---
|
||||||
|
name: '📜 Documentation'
|
||||||
|
about: 'Correct spelling errors, improvements or additions to documentation files (README, CONTRIBUTING...).'
|
||||||
|
title: '[Documentation]'
|
||||||
|
labels: 'documentation'
|
||||||
|
---
|
||||||
|
|
||||||
|
<!-- Please make sure your issue has not already been fixed. -->
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
<!-- Please uncomment the type of documentation problem this issue address -->
|
||||||
|
|
||||||
|
<!-- Documentation is Missing -->
|
||||||
|
<!-- Documentation is Confusing -->
|
||||||
|
<!-- Documentation has Typo errors -->
|
||||||
|
|
||||||
|
## Proposal
|
20
.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md
vendored
Normal file
20
.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
name: '✨ Feature Request'
|
||||||
|
about: 'Suggest a new feature idea.'
|
||||||
|
title: '[Feature]'
|
||||||
|
labels: 'feature request'
|
||||||
|
---
|
||||||
|
|
||||||
|
<!-- Please make sure your issue has not already been fixed. -->
|
||||||
|
|
||||||
|
## Description
|
||||||
|
|
||||||
|
<!-- A clear and concise description of the problem or missing capability... -->
|
||||||
|
|
||||||
|
## Describe the solution you'd like
|
||||||
|
|
||||||
|
<!-- If you have a solution in mind, please describe it. -->
|
||||||
|
|
||||||
|
## Describe alternatives you've considered
|
||||||
|
|
||||||
|
<!-- Have you considered any alternative solutions or workarounds? -->
|
20
.github/ISSUE_TEMPLATE/IMPROVEMENT.md
vendored
Normal file
20
.github/ISSUE_TEMPLATE/IMPROVEMENT.md
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
name: '🔧 Improvement'
|
||||||
|
about: 'Improve structure/format/performance/refactor/tests of the code.'
|
||||||
|
title: '[Improvement]'
|
||||||
|
labels: 'improvement'
|
||||||
|
---
|
||||||
|
|
||||||
|
<!-- Please make sure your issue has not already been fixed. -->
|
||||||
|
|
||||||
|
## Type of Improvement
|
||||||
|
|
||||||
|
<!-- Please uncomment the type of improvements this issue address -->
|
||||||
|
|
||||||
|
<!-- Files and Folders Structure -->
|
||||||
|
<!-- Performance -->
|
||||||
|
<!-- Refactoring code -->
|
||||||
|
<!-- Tests -->
|
||||||
|
<!-- Not Sure? -->
|
||||||
|
|
||||||
|
## Proposal
|
8
.github/ISSUE_TEMPLATE/QUESTION.md
vendored
Normal file
8
.github/ISSUE_TEMPLATE/QUESTION.md
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
name: '🙋 Question'
|
||||||
|
about: 'Further information is requested.'
|
||||||
|
title: '[Question]'
|
||||||
|
labels: 'question'
|
||||||
|
---
|
||||||
|
|
||||||
|
### Question
|
7
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
7
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<!-- Please first discuss the change you wish to make via issue before making a change. It might avoid a waste of your time. -->
|
||||||
|
|
||||||
|
## What changes this PR introduce?
|
||||||
|
|
||||||
|
## List any relevant issue numbers
|
||||||
|
|
||||||
|
## Is there anything you'd like reviewers to focus on?
|
28
.github/workflows/lint.yml
vendored
Normal file
28
.github/workflows/lint.yml
vendored
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
name: 'Lint'
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [master, develop]
|
||||||
|
pull_request:
|
||||||
|
branches: [master, develop]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lint:
|
||||||
|
runs-on: 'ubuntu-latest'
|
||||||
|
steps:
|
||||||
|
- uses: 'actions/checkout@v2.4.0'
|
||||||
|
|
||||||
|
- name: 'Use Node.js'
|
||||||
|
uses: 'actions/setup-node@v2.5.1'
|
||||||
|
with:
|
||||||
|
node-version: 'lts/*'
|
||||||
|
cache: 'npm'
|
||||||
|
|
||||||
|
- name: 'Install'
|
||||||
|
run: 'npm install'
|
||||||
|
|
||||||
|
- run: 'npm run lint:commit -- --to "${{ github.sha }}"'
|
||||||
|
- run: 'npm run lint:editorconfig'
|
||||||
|
- run: 'npm run lint:markdown'
|
||||||
|
- run: 'npm run lint:javascript'
|
||||||
|
- run: 'npm run lint:prettier'
|
25
.github/workflows/test.yml
vendored
Normal file
25
.github/workflows/test.yml
vendored
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
name: 'Test'
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [master, develop]
|
||||||
|
pull_request:
|
||||||
|
branches: [master, develop]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: 'ubuntu-latest'
|
||||||
|
steps:
|
||||||
|
- uses: 'actions/checkout@v2.4.0'
|
||||||
|
|
||||||
|
- name: 'Use Node.js'
|
||||||
|
uses: 'actions/setup-node@v2.5.1'
|
||||||
|
with:
|
||||||
|
node-version: 'lts/*'
|
||||||
|
cache: 'npm'
|
||||||
|
|
||||||
|
- name: 'Install'
|
||||||
|
run: 'npm install'
|
||||||
|
|
||||||
|
- name: 'Test'
|
||||||
|
run: 'npm run test'
|
28
.gitignore
vendored
Normal file
28
.gitignore
vendored
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
# dependencies
|
||||||
|
node_modules
|
||||||
|
.npm
|
||||||
|
|
||||||
|
# testing
|
||||||
|
coverage
|
||||||
|
|
||||||
|
# debug
|
||||||
|
npm-debug.log*
|
||||||
|
|
||||||
|
# IDEs and editors
|
||||||
|
/.idea
|
||||||
|
.project
|
||||||
|
.classpath
|
||||||
|
.c9/
|
||||||
|
*.launch
|
||||||
|
.settings/
|
||||||
|
*.sublime-workspace
|
||||||
|
|
||||||
|
# IDE - VSCode
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/settings.json
|
||||||
|
!.vscode/tasks.json
|
||||||
|
!.vscode/launch.json
|
||||||
|
!.vscode/extensions.json
|
||||||
|
|
||||||
|
# misc
|
||||||
|
.DS_Store
|
4
.husky/commit-msg
Executable file
4
.husky/commit-msg
Executable file
@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
. "$(dirname "$0")/_/husky.sh"
|
||||||
|
|
||||||
|
npm run lint:commit -- --edit
|
5
.husky/pre-commit
Executable file
5
.husky/pre-commit
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
. "$(dirname "$0")/_/husky.sh"
|
||||||
|
|
||||||
|
npm run lint:staged
|
||||||
|
npm run test
|
6
.lintstagedrc.json
Normal file
6
.lintstagedrc.json
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"*": ["editorconfig-checker"],
|
||||||
|
"*.{js,jsx,ts,tsx}": ["prettier --write", "eslint --fix"],
|
||||||
|
"*.{json,jsonc,yml,yaml}": ["prettier --write"],
|
||||||
|
"*.{md,mdx}": ["prettier --write", "markdownlint --dot --fix"]
|
||||||
|
}
|
6
.markdownlint.json
Normal file
6
.markdownlint.json
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"default": true,
|
||||||
|
"MD013": false,
|
||||||
|
"MD033": false,
|
||||||
|
"MD041": false
|
||||||
|
}
|
6
.prettierrc.json
Normal file
6
.prettierrc.json
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"singleQuote": true,
|
||||||
|
"jsxSingleQuote": true,
|
||||||
|
"semi": false,
|
||||||
|
"trailingComma": "none"
|
||||||
|
}
|
19
.releaserc.json
Normal file
19
.releaserc.json
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"branches": ["master"],
|
||||||
|
"plugins": [
|
||||||
|
[
|
||||||
|
"@semantic-release/commit-analyzer",
|
||||||
|
{
|
||||||
|
"preset": "conventionalcommits"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"@semantic-release/release-notes-generator",
|
||||||
|
{
|
||||||
|
"preset": "conventionalcommits"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@semantic-release/npm",
|
||||||
|
"@semantic-release/github"
|
||||||
|
]
|
||||||
|
}
|
8
.vscode/extensions.json
vendored
Normal file
8
.vscode/extensions.json
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"recommendations": [
|
||||||
|
"editorconfig.editorconfig",
|
||||||
|
"esbenp.prettier-vscode",
|
||||||
|
"dbaeumer.vscode-eslint",
|
||||||
|
"davidanson.vscode-markdownlint"
|
||||||
|
]
|
||||||
|
}
|
10
.vscode/settings.json
vendored
Normal file
10
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"typescript.tsdk": "node_modules/typescript/lib",
|
||||||
|
"typescript.preferences.importModuleSpecifierEnding": "js",
|
||||||
|
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||||
|
"prettier.configPath": ".prettierrc.json",
|
||||||
|
"editor.formatOnSave": true,
|
||||||
|
"editor.codeActionsOnSave": {
|
||||||
|
"source.fixAll": true
|
||||||
|
}
|
||||||
|
}
|
132
CODE_OF_CONDUCT.md
Normal file
132
CODE_OF_CONDUCT.md
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
# Contributor Covenant Code of Conduct
|
||||||
|
|
||||||
|
## Our Pledge
|
||||||
|
|
||||||
|
We as members, contributors, and leaders pledge to make participation in our
|
||||||
|
community a harassment-free experience for everyone, regardless of age, body
|
||||||
|
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
||||||
|
identity and expression, level of experience, education, socio-economic status,
|
||||||
|
nationality, personal appearance, race, religion, or sexual identity
|
||||||
|
and orientation.
|
||||||
|
|
||||||
|
We pledge to act and interact in ways that contribute to an open, welcoming,
|
||||||
|
diverse, inclusive, and healthy community.
|
||||||
|
|
||||||
|
## Our Standards
|
||||||
|
|
||||||
|
Examples of behavior that contributes to a positive environment for our
|
||||||
|
community include:
|
||||||
|
|
||||||
|
- Demonstrating empathy and kindness toward other people
|
||||||
|
- Being respectful of differing opinions, viewpoints, and experiences
|
||||||
|
- Giving and gracefully accepting constructive feedback
|
||||||
|
- Accepting responsibility and apologizing to those affected by our mistakes,
|
||||||
|
and learning from the experience
|
||||||
|
- Focusing on what is best not just for us as individuals, but for the
|
||||||
|
overall community
|
||||||
|
|
||||||
|
Examples of unacceptable behavior include:
|
||||||
|
|
||||||
|
- The use of sexualized language or imagery, and sexual attention or
|
||||||
|
advances of any kind
|
||||||
|
- Trolling, insulting or derogatory comments, and personal or political attacks
|
||||||
|
- Public or private harassment
|
||||||
|
- Publishing others' private information, such as a physical or email
|
||||||
|
address, without their explicit permission
|
||||||
|
- Other conduct which could reasonably be considered inappropriate in a
|
||||||
|
professional setting
|
||||||
|
|
||||||
|
## Enforcement Responsibilities
|
||||||
|
|
||||||
|
Community leaders are responsible for clarifying and enforcing our standards of
|
||||||
|
acceptable behavior and will take appropriate and fair corrective action in
|
||||||
|
response to any behavior that they deem inappropriate, threatening, offensive,
|
||||||
|
or harmful.
|
||||||
|
|
||||||
|
Community leaders have the right and responsibility to remove, edit, or reject
|
||||||
|
comments, commits, code, wiki edits, issues, and other contributions that are
|
||||||
|
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
||||||
|
decisions when appropriate.
|
||||||
|
|
||||||
|
## Scope
|
||||||
|
|
||||||
|
This Code of Conduct applies within all community spaces, and also applies when
|
||||||
|
an individual is officially representing the community in public spaces.
|
||||||
|
Examples of representing our community include using an official e-mail address,
|
||||||
|
posting via an official social media account, or acting as an appointed
|
||||||
|
representative at an online or offline event.
|
||||||
|
|
||||||
|
## Enforcement
|
||||||
|
|
||||||
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||||
|
reported to the community leaders responsible for enforcement at
|
||||||
|
contact@divlo.fr.
|
||||||
|
All complaints will be reviewed and investigated promptly and fairly.
|
||||||
|
|
||||||
|
All community leaders are obligated to respect the privacy and security of the
|
||||||
|
reporter of any incident.
|
||||||
|
|
||||||
|
## Enforcement Guidelines
|
||||||
|
|
||||||
|
Community leaders will follow these Community Impact Guidelines in determining
|
||||||
|
the consequences for any action they deem in violation of this Code of Conduct:
|
||||||
|
|
||||||
|
### 1. Correction
|
||||||
|
|
||||||
|
**Community Impact**: Use of inappropriate language or other behavior deemed
|
||||||
|
unprofessional or unwelcome in the community.
|
||||||
|
|
||||||
|
**Consequence**: A private, written warning from community leaders, providing
|
||||||
|
clarity around the nature of the violation and an explanation of why the
|
||||||
|
behavior was inappropriate. A public apology may be requested.
|
||||||
|
|
||||||
|
### 2. Warning
|
||||||
|
|
||||||
|
**Community Impact**: A violation through a single incident or series
|
||||||
|
of actions.
|
||||||
|
|
||||||
|
**Consequence**: A warning with consequences for continued behavior. No
|
||||||
|
interaction with the people involved, including unsolicited interaction with
|
||||||
|
those enforcing the Code of Conduct, for a specified period of time. This
|
||||||
|
includes avoiding interactions in community spaces as well as external channels
|
||||||
|
like social media. Violating these terms may lead to a temporary or
|
||||||
|
permanent ban.
|
||||||
|
|
||||||
|
### 3. Temporary Ban
|
||||||
|
|
||||||
|
**Community Impact**: A serious violation of community standards, including
|
||||||
|
sustained inappropriate behavior.
|
||||||
|
|
||||||
|
**Consequence**: A temporary ban from any sort of interaction or public
|
||||||
|
communication with the community for a specified period of time. No public or
|
||||||
|
private interaction with the people involved, including unsolicited interaction
|
||||||
|
with those enforcing the Code of Conduct, is allowed during this period.
|
||||||
|
Violating these terms may lead to a permanent ban.
|
||||||
|
|
||||||
|
### 4. Permanent Ban
|
||||||
|
|
||||||
|
**Community Impact**: Demonstrating a pattern of violation of community
|
||||||
|
standards, including sustained inappropriate behavior, harassment of an
|
||||||
|
individual, or aggression toward or disparagement of classes of individuals.
|
||||||
|
|
||||||
|
**Consequence**: A permanent ban from any sort of public interaction within
|
||||||
|
the community.
|
||||||
|
|
||||||
|
## Attribution
|
||||||
|
|
||||||
|
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||||
|
version 2.0, available at
|
||||||
|
[https://www.contributor-covenant.org/version/2/0/code_of_conduct.html][v2.0].
|
||||||
|
|
||||||
|
Community Impact Guidelines were inspired by
|
||||||
|
[Mozilla's code of conduct enforcement ladder][mozilla coc].
|
||||||
|
|
||||||
|
For answers to common questions about this code of conduct, see the FAQ at
|
||||||
|
[https://www.contributor-covenant.org/faq][faq]. Translations are available
|
||||||
|
at [https://www.contributor-covenant.org/translations][translations].
|
||||||
|
|
||||||
|
[homepage]: https://www.contributor-covenant.org
|
||||||
|
[v2.0]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html
|
||||||
|
[mozilla coc]: https://github.com/mozilla/diversity
|
||||||
|
[faq]: https://www.contributor-covenant.org/faq
|
||||||
|
[translations]: https://www.contributor-covenant.org/translations
|
46
CONTRIBUTING.md
Normal file
46
CONTRIBUTING.md
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
# 💡 Contributing
|
||||||
|
|
||||||
|
Thanks a lot for your interest in contributing to **eslint-config-conventions**! 🎉
|
||||||
|
|
||||||
|
## Types of contributions
|
||||||
|
|
||||||
|
- Reporting a bug.
|
||||||
|
- Suggest a new feature idea.
|
||||||
|
- Correct spelling errors, improvements or additions to documentation files (README, CONTRIBUTING...).
|
||||||
|
- Improve structure/format/performance/refactor/tests of the code.
|
||||||
|
|
||||||
|
## Pull Requests
|
||||||
|
|
||||||
|
- **Please first discuss** the change you wish to make via [issue](https://github.com/Divlo/eslint-config-conventions/issues) before making a change. It might avoid a waste of your time.
|
||||||
|
|
||||||
|
- Ensure your code respect linting.
|
||||||
|
|
||||||
|
- Make sure your **code passes the tests**.
|
||||||
|
|
||||||
|
If you're adding new features to **eslint-config-conventions**, please include tests.
|
||||||
|
|
||||||
|
## Commits
|
||||||
|
|
||||||
|
The commit message guidelines respect [@commitlint/config-conventional](https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional) and [Semantic Versioning](https://semver.org/) for releases.
|
||||||
|
|
||||||
|
### Types
|
||||||
|
|
||||||
|
Types define which kind of changes you made to the project.
|
||||||
|
|
||||||
|
| Types | Description |
|
||||||
|
| -------- | ------------------------------------------------------------------------------------------------------------ |
|
||||||
|
| feat | A new feature. |
|
||||||
|
| fix | A bug fix. |
|
||||||
|
| docs | Documentation only changes. |
|
||||||
|
| style | Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc). |
|
||||||
|
| refactor | A code change that neither fixes a bug nor adds a feature. |
|
||||||
|
| perf | A code change that improves performance. |
|
||||||
|
| test | Adding missing tests or correcting existing tests. |
|
||||||
|
| build | Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm). |
|
||||||
|
| ci | Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs). |
|
||||||
|
| chore | Other changes that don't modify src or test files. |
|
||||||
|
| revert | Reverts a previous commit. |
|
||||||
|
|
||||||
|
### Scopes
|
||||||
|
|
||||||
|
Scopes define what part of the code changed.
|
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Divlo
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
127
README.md
Normal file
127
README.md
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
<h1 align="center">eslint-config-conventions</h1>
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<strong><a href="https://eslint.org/docs/developer-guide/shareable-configs">ESLint shareable config</a> to enforce strict conventions and good code quality.</strong>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<a href="./CONTRIBUTING.md"><img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat" /></a>
|
||||||
|
<a href="./LICENSE"><img src="https://img.shields.io/badge/licence-MIT-blue.svg" alt="Licence MIT"/></a>
|
||||||
|
<a href="./CODE_OF_CONDUCT.md"><img src="https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg" alt="Contributor Covenant" /></a>
|
||||||
|
<br />
|
||||||
|
<a href="https://github.com/Divlo/eslint-config-conventions/actions/workflows/build.yml"><img src="https://github.com/Divlo/eslint-config-conventions/build.yml/badge.svg?branch=develop" /></a>
|
||||||
|
<a href="https://github.com/Divlo/eslint-config-conventions/actions/workflows/lint.yml"><img src="https://github.com/Divlo/eslint-config-conventions/actions/workflows/lint.yml/badge.svg?branch=develop" /></a>
|
||||||
|
<a href="https://github.com/Divlo/eslint-config-conventions/actions/workflows/test.yml"><img src="https://github.com/Divlo/eslint-config-conventions/actions/workflows/test.yml/badge.svg?branch=develop" /></a>
|
||||||
|
<br />
|
||||||
|
<a href="https://conventionalcommits.org"><img src="https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg" alt="Conventional Commits" /></a>
|
||||||
|
<a href="https://github.com/semantic-release/semantic-release"><img src="https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg" alt="semantic-release" /></a>
|
||||||
|
<a href="https://www.npmjs.com/package/eslint-config-conventions"><img src="https://img.shields.io/npm/v/eslint-config-conventions.svg" alt="npm version"></a>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
## 📜 About
|
||||||
|
|
||||||
|
**eslint-config-conventions** is a [ESLint](https://eslint.org) configuration to enforce strict conventions and good code quality, it is highly inspired from [eslint-config-standard-with-typescript](https://github.com/standard/eslint-config-standard-with-typescript) but it is **stricter** and with **no formatting rules**, **only code-quality rules**.
|
||||||
|
|
||||||
|
This configuration is mostly **for catching bugs** and **code-quality** so it is recommanded to use it with [Prettier](https://prettier.io/) for a consistent code style, it works with any `.prettierrc.json` configuration.
|
||||||
|
|
||||||
|
More information about **formatting rules** vs **code-quality rules** can be found on [Prettier vs. Linters](https://prettier.io/docs/en/comparison.html).
|
||||||
|
|
||||||
|
## ⚙️ Getting Started
|
||||||
|
|
||||||
|
### Prerequisites
|
||||||
|
|
||||||
|
- [Node.js](https://nodejs.org/) >= 16.0.0
|
||||||
|
|
||||||
|
### Installation
|
||||||
|
|
||||||
|
`npm@<7` does not automatically install `peerDependencies`, so if that's what you're using, install them manually.
|
||||||
|
Here is an example, but use it only for reference, because your decisions regarding version ranges and range specifiers may vary.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm install --save-dev \
|
||||||
|
eslint@^8.9.0 \
|
||||||
|
eslint-plugin-import@^2.25.4 \
|
||||||
|
eslint-plugin-promise@^6.0.0 \
|
||||||
|
eslint-plugin-unicorn@^41.0.0 \
|
||||||
|
typescript@^4.4.0 \
|
||||||
|
@typescript-eslint/eslint-plugin@^5.12.0 \
|
||||||
|
eslint-config-conventions@latest
|
||||||
|
```
|
||||||
|
|
||||||
|
Yes, this is a large number of packages. This is due to [a known limitation in ESLint](https://github.com/eslint/eslint/issues/3458).
|
||||||
|
|
||||||
|
This list of dependencies are:
|
||||||
|
|
||||||
|
- [ESLint](https://github.com/eslint/eslint)
|
||||||
|
- 3 [ESLint Plugins](https://eslint.org/docs/user-guide/configuring/plugins)
|
||||||
|
- [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import)
|
||||||
|
- [eslint-plugin-promise](https://github.com/xjamundx/eslint-plugin-promise)
|
||||||
|
- [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn)
|
||||||
|
- [TypeScript](https://github.com/Microsoft/TypeScript)
|
||||||
|
- [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint); ESLint rules for TypeScript.
|
||||||
|
- This package: `eslint-config-conventions`
|
||||||
|
|
||||||
|
### Configuration with [Prettier](https://prettier.io/) (recommended)
|
||||||
|
|
||||||
|
You will need to install some dependencies in addition to those required:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm install --save-dev prettier eslint-config-prettier eslint-plugin-prettier
|
||||||
|
|
||||||
|
# Create an empty config file to let editors and other tools know you are using Prettier
|
||||||
|
# You can personalize it with your own rules
|
||||||
|
echo {}> .prettierrc.json
|
||||||
|
```
|
||||||
|
|
||||||
|
#### `.eslintrc.json`
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"extends": ["conventions", "prettier"],
|
||||||
|
"plugins": ["prettier"],
|
||||||
|
"parserOptions": {
|
||||||
|
"project": "./tsconfig.json"
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"prettier/prettier": "error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Note:** Please read some important instructions regarding the `project` option [here](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/parser/README.md#configuration).
|
||||||
|
|
||||||
|
You must have a valid `tsconfig.json` file to specify `"parserOptions.project"`.
|
||||||
|
|
||||||
|
#### `package.json`
|
||||||
|
|
||||||
|
```jsonc
|
||||||
|
{
|
||||||
|
"scripts": {
|
||||||
|
"lint:typescript": "eslint \"**/*.{js,jsx,ts,tsx}\" --ignore-path \".gitignore\"",
|
||||||
|
"lint:prettier": "prettier \".\" --check --ignore-path \".gitignore\""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Usage
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm run lint:typescript
|
||||||
|
# or to apply automatic fixes to code
|
||||||
|
npm run lint:typescript -- --fix
|
||||||
|
|
||||||
|
# Validate code formatting in all supported languages by Prettier
|
||||||
|
npm run lint:prettier
|
||||||
|
```
|
||||||
|
|
||||||
|
## 💡 Contributing
|
||||||
|
|
||||||
|
Anyone can help to improve the project, submit a Feature Request, a bug report or even correct a simple spelling mistake.
|
||||||
|
|
||||||
|
The steps to contribute can be found in the [CONTRIBUTING.md](./CONTRIBUTING.md) file.
|
||||||
|
|
||||||
|
## 📄 License
|
||||||
|
|
||||||
|
[MIT](./LICENSE)
|
16280
package-lock.json
generated
Normal file
16280
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
72
package.json
Normal file
72
package.json
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
{
|
||||||
|
"name": "eslint-config-conventions",
|
||||||
|
"version": "0.0.0-development",
|
||||||
|
"public": true,
|
||||||
|
"description": "ESLint shareable config to enforce strict conventions and good code quality.",
|
||||||
|
"author": "Divlo <contact@divlo.fr>",
|
||||||
|
"license": "MIT",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/Divlo/eslint-config-conventions.git"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/Divlo/eslint-config-conventions/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/Divlo/eslint-config-conventions#readme",
|
||||||
|
"keywords": [
|
||||||
|
"eslintconfig",
|
||||||
|
"eslint",
|
||||||
|
"quality",
|
||||||
|
"strict linter",
|
||||||
|
"validate",
|
||||||
|
"code quality",
|
||||||
|
"conventions"
|
||||||
|
],
|
||||||
|
"main": "index.js",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=16.0.0",
|
||||||
|
"npm": ">=8.0.0"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"lint:commit": "commitlint",
|
||||||
|
"lint:editorconfig": "editorconfig-checker",
|
||||||
|
"lint:markdown": "markdownlint \"**/*.md\" --dot --ignore-path \".gitignore\"",
|
||||||
|
"lint:javascript": "eslint \"**/*.{js,jsx,ts,tsx}\"",
|
||||||
|
"lint:prettier": "prettier \".\" --check --ignore-path \".gitignore\"",
|
||||||
|
"lint:staged": "lint-staged",
|
||||||
|
"test": "tape \"test/**/*.js\"",
|
||||||
|
"release": "semantic-release",
|
||||||
|
"postinstall": "husky install",
|
||||||
|
"prepublishOnly": "pinst --disable",
|
||||||
|
"postpublish": "pinst --enable"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"eslint": "^8.9.0",
|
||||||
|
"eslint-plugin-import": "^2.25.4",
|
||||||
|
"eslint-plugin-promise": "^6.0.0",
|
||||||
|
"eslint-plugin-unicorn": "^41.0.0",
|
||||||
|
"typescript": "^4.4.0",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^5.12.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@commitlint/cli": "16.2.1",
|
||||||
|
"@commitlint/config-conventional": "16.2.1",
|
||||||
|
"editorconfig-checker": "4.0.2",
|
||||||
|
"eslint": "8.9.0",
|
||||||
|
"@types/eslint": "8.4.1",
|
||||||
|
"eslint-plugin-import": "2.25.4",
|
||||||
|
"eslint-plugin-promise": "6.0.0",
|
||||||
|
"eslint-plugin-unicorn": "41.0.0",
|
||||||
|
"typescript": "4.5.5",
|
||||||
|
"@typescript-eslint/parser": "5.12.0",
|
||||||
|
"@typescript-eslint/eslint-plugin": "5.12.0",
|
||||||
|
"tape": "5.5.2",
|
||||||
|
"husky": "7.0.4",
|
||||||
|
"lint-staged": "12.3.4",
|
||||||
|
"markdownlint-cli": "0.31.1",
|
||||||
|
"@types/tape": "4.13.2",
|
||||||
|
"pinst": "2.1.6",
|
||||||
|
"prettier": "2.5.1",
|
||||||
|
"semantic-release": "19.0.2"
|
||||||
|
}
|
||||||
|
}
|
15
test/basic.js
Normal file
15
test/basic.js
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
const test = require('tape')
|
||||||
|
|
||||||
|
const config = require('../index.js')
|
||||||
|
|
||||||
|
test('test basic properties of config', function (t) {
|
||||||
|
t.ok(isObject(config.parserOptions))
|
||||||
|
t.ok(isObject(config.env))
|
||||||
|
t.ok(isObject(config.rules))
|
||||||
|
t.ok(isObject(config.overrides))
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
function isObject(object) {
|
||||||
|
return typeof object === 'object' && object !== null
|
||||||
|
}
|
5
test/fixtures/javascript-no-errors.js
vendored
Normal file
5
test/fixtures/javascript-no-errors.js
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
const foo = 1
|
||||||
|
const bar = (argument) => {
|
||||||
|
return argument + foo
|
||||||
|
}
|
||||||
|
bar(foo)
|
1
test/fixtures/javascript-with-errors.js
vendored
Normal file
1
test/fixtures/javascript-with-errors.js
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
'invalid eqeqeq' == 'invalid eqeqeq'
|
3
test/fixtures/top-level-await.mjs
vendored
Normal file
3
test/fixtures/top-level-await.mjs
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
const foo = await 1
|
||||||
|
const bar = function () {}
|
||||||
|
await bar(foo)
|
5
test/fixtures/typescript-no-errors.ts
vendored
Normal file
5
test/fixtures/typescript-no-errors.ts
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
const foo = 1
|
||||||
|
const bar = (argument: number): number => {
|
||||||
|
return argument + foo
|
||||||
|
}
|
||||||
|
bar(foo)
|
5
test/fixtures/typescript-with-errors.ts
vendored
Normal file
5
test/fixtures/typescript-with-errors.ts
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
const foo = 1
|
||||||
|
const bar = (argument: number) => {
|
||||||
|
return argument + foo
|
||||||
|
}
|
||||||
|
bar(foo)
|
37
test/validate-config.js
Normal file
37
test/validate-config.js
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
const { ESLint } = require('eslint')
|
||||||
|
const test = require('tape')
|
||||||
|
|
||||||
|
test('ensure we validate correctly JavaScript files', async (t) => {
|
||||||
|
const eslint = new ESLint({ ignore: false })
|
||||||
|
const [noErrors] = await eslint.lintFiles(
|
||||||
|
'test/fixtures/javascript-no-errors.js'
|
||||||
|
)
|
||||||
|
const [withErrors] = await eslint.lintFiles(
|
||||||
|
'test/fixtures/javascript-with-errors.js'
|
||||||
|
)
|
||||||
|
t.equal(noErrors.errorCount, 0)
|
||||||
|
t.equal(withErrors.errorCount, 3)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('ensure we validate correctly TypeScript files', async (t) => {
|
||||||
|
const eslint = new ESLint({ ignore: false })
|
||||||
|
const [noErrors] = await eslint.lintFiles(
|
||||||
|
'test/fixtures/typescript-no-errors.ts'
|
||||||
|
)
|
||||||
|
const [withErrors] = await eslint.lintFiles(
|
||||||
|
'test/fixtures/javascript-with-errors.js'
|
||||||
|
)
|
||||||
|
t.equal(noErrors.errorCount, 0)
|
||||||
|
t.equal(withErrors.errorCount, 3)
|
||||||
|
t.end()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('ensure we allow top-level await', async (t) => {
|
||||||
|
const eslint = new ESLint({ ignore: false })
|
||||||
|
const [lintResult] = await eslint.lintFiles(
|
||||||
|
'test/fixtures/top-level-await.mjs'
|
||||||
|
)
|
||||||
|
t.equal(lintResult.errorCount, 0)
|
||||||
|
t.end()
|
||||||
|
})
|
12
tsconfig.json
Normal file
12
tsconfig.json
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ESNext",
|
||||||
|
"module": "commonjs",
|
||||||
|
"lib": ["ESNext"],
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"rootDir": "./",
|
||||||
|
"strict": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"esModuleInterop": true
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user