1
1
mirror of https://github.com/theoludwig/eslint-config-conventions.git synced 2025-05-18 12:02:33 +02:00

Compare commits

..

10 Commits

Author SHA1 Message Date
1779517f5c feat: add @typescript-eslint/ban-types
BREAKING CHANGE: New rule introduced
2023-02-06 23:52:11 +01:00
81b37b523c feat: add import/no-empty-named-blocks
BREAKING CHANGE: New rule introduced
2023-02-06 23:48:24 +01:00
a95ac7ec8b fix: relax @typescript-eslint/consistent-type-assertions 2023-02-06 23:43:23 +01:00
32481c316f fix: relax no-unused-vars ignore variable starting with _ 2023-02-06 23:42:09 +01:00
c3ddbc73b7 feat: add no-empty-static-block
Ref: https://eslint.org/docs/latest/rules/no-empty-static-block

BREAKING CHANGE: New rule introduced
2023-02-06 23:37:55 +01:00
1934d3525a feat: add no-new-native-nonconstructor
Ref: https://eslint.org/docs/latest/rules/no-new-native-nonconstructor

BREAKING CHANGE: New rule introduced
2023-02-06 23:36:21 +01:00
4f625c3b88 build(deps): update latest
BREAKING CHANGE: peerDependencies:
`eslint@^8.33.0`, `eslint-plugin-import@^2.27.5`,
`eslint-plugin-promise@^6.1.1`, `eslint-plugin-unicorn@^45.0.2`
2023-02-06 23:33:28 +01:00
e24964a60a build(deps): update latest 2023-01-10 13:27:35 +01:00
fcc107bdec fix: relax @typescript-eslint/prefer-optional-chain 2022-11-21 09:09:06 +01:00
666a3dee2d feat: add unicorn/no-typeof-undefined
BREAKING CHANGE: New rule introduced

BREAKING CHANGE: peerDependencies: `eslint-plugin-unicorn@^45.0.0`
2022-11-21 09:08:19 +01:00
8 changed files with 1566 additions and 10103 deletions

View File

@ -34,6 +34,7 @@
"no-duplicate-imports": "error", "no-duplicate-imports": "error",
"no-empty-character-class": "error", "no-empty-character-class": "error",
"no-empty-pattern": "error", "no-empty-pattern": "error",
"no-empty-static-block": "error",
"no-ex-assign": "error", "no-ex-assign": "error",
"no-fallthrough": "error", "no-fallthrough": "error",
"no-func-assign": "error", "no-func-assign": "error",
@ -42,6 +43,7 @@
"no-irregular-whitespace": "error", "no-irregular-whitespace": "error",
"no-loss-of-precision": "error", "no-loss-of-precision": "error",
"no-misleading-character-class": "error", "no-misleading-character-class": "error",
"no-new-native-nonconstructor": "error",
"no-new-symbol": "error", "no-new-symbol": "error",
"no-obj-calls": "error", "no-obj-calls": "error",
"no-promise-executor-return": "error", "no-promise-executor-return": "error",
@ -59,7 +61,7 @@
"no-unsafe-negation": "error", "no-unsafe-negation": "error",
"no-unsafe-optional-chaining": "error", "no-unsafe-optional-chaining": "error",
"no-unused-private-class-members": "error", "no-unused-private-class-members": "error",
"no-unused-vars": "error", "no-unused-vars": ["error", { "varsIgnorePattern": "^_" }],
"no-use-before-define": [ "no-use-before-define": [
"error", "error",
{ {
@ -166,6 +168,7 @@
} }
], ],
"import/no-named-default": "error", "import/no-named-default": "error",
"import/no-empty-named-blocks": "error",
"promise/param-names": "error", "promise/param-names": "error",
"promise/no-new-statics": "error", "promise/no-new-statics": "error",
@ -181,7 +184,8 @@
"unicorn/no-this-assignment": "error", "unicorn/no-this-assignment": "error",
"unicorn/no-zero-fractions": "error", "unicorn/no-zero-fractions": "error",
"unicorn/prefer-node-protocol": "error", "unicorn/prefer-node-protocol": "error",
"unicorn/throw-new-error": "error" "unicorn/throw-new-error": "error",
"unicorn/no-typeof-undefined": "error"
}, },
"overrides": [ "overrides": [
{ {
@ -197,7 +201,10 @@
"no-loss-of-precision": "off", "no-loss-of-precision": "off",
"@typescript-eslint/no-loss-of-precision": "error", "@typescript-eslint/no-loss-of-precision": "error",
"no-unused-vars": "off", "no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "error", "@typescript-eslint/no-unused-vars": [
"error",
{ "varsIgnorePattern": "^_" }
],
"no-use-before-define": "off", "no-use-before-define": "off",
"@typescript-eslint/no-use-before-define": [ "@typescript-eslint/no-use-before-define": [
"error", "error",
@ -241,13 +248,7 @@
"error", "error",
{ "default": "array-simple" } { "default": "array-simple" }
], ],
"@typescript-eslint/consistent-type-assertions": [ "@typescript-eslint/ban-types": "error",
"error",
{
"assertionStyle": "as",
"objectLiteralTypeAssertions": "never"
}
],
"@typescript-eslint/consistent-type-definitions": [ "@typescript-eslint/consistent-type-definitions": [
"error", "error",
"interface" "interface"
@ -308,7 +309,6 @@
"ignoreMixedLogicalExpressions": false "ignoreMixedLogicalExpressions": false
} }
], ],
"@typescript-eslint/prefer-optional-chain": "error",
"@typescript-eslint/prefer-readonly": "error", "@typescript-eslint/prefer-readonly": "error",
"@typescript-eslint/prefer-reduce-type-parameter": "error", "@typescript-eslint/prefer-reduce-type-parameter": "error",
"@typescript-eslint/prefer-ts-expect-error": "error", "@typescript-eslint/prefer-ts-expect-error": "error",

View File

@ -24,5 +24,5 @@ jobs:
- run: 'npm run lint:commit -- --to "${{ github.sha }}"' - run: 'npm run lint:commit -- --to "${{ github.sha }}"'
- run: 'npm run lint:editorconfig' - run: 'npm run lint:editorconfig'
- run: 'npm run lint:markdown' - run: 'npm run lint:markdown'
- run: 'npm run lint:javascript' - run: 'npm run lint:eslint'
- run: 'npm run lint:prettier' - run: 'npm run lint:prettier'

View File

@ -1,10 +1,5 @@
{ {
"config": {
"default": true,
"MD013": false,
"MD033": false,
"MD041": false
},
"globs": ["**/*.{md,mdx}"], "globs": ["**/*.{md,mdx}"],
"ignores": ["**/node_modules"] "ignores": ["**/node_modules"],
"customRules": ["markdownlint-rule-relative-links"]
} }

7
.markdownlint.json Normal file
View File

@ -0,0 +1,7 @@
{
"default": true,
"relative-links": true,
"extends": "markdownlint/style/prettier",
"MD033": false,
"MD041": false
}

View File

@ -40,10 +40,10 @@ Here is an example, but use it only for reference, because your decisions regard
```sh ```sh
npm install --save-dev \ npm install --save-dev \
eslint@^8.9.0 \ eslint@^8.33.0 \
eslint-plugin-import@^2.26.0 \ eslint-plugin-import@^2.27.5 \
eslint-plugin-promise@^6.0.0 \ eslint-plugin-promise@^6.1.1 \
eslint-plugin-unicorn@^44.0.0 \ eslint-plugin-unicorn@^45.0.2 \
eslint-config-conventions@latest eslint-config-conventions@latest
``` ```
@ -109,7 +109,7 @@ echo {}> .prettierrc.json
```jsonc ```jsonc
{ {
"scripts": { "scripts": {
"lint:typescript": "eslint \"**/*.{js,jsx,ts,tsx}\" --ignore-path \".gitignore\"", "lint:eslint": "eslint \"**/*.{js,jsx,ts,tsx}\" --ignore-path \".gitignore\"",
"lint:prettier": "prettier \".\" --check --ignore-path \".gitignore\"" "lint:prettier": "prettier \".\" --check --ignore-path \".gitignore\""
} }
} }
@ -118,9 +118,9 @@ echo {}> .prettierrc.json
### Usage ### Usage
```sh ```sh
npm run lint:typescript npm run lint:eslint
# or to apply automatic fixes to code # or to apply automatic fixes to code
npm run lint:typescript -- --fix npm run lint:eslint -- --fix
# Validate code formatting in all supported languages by Prettier # Validate code formatting in all supported languages by Prettier
npm run lint:prettier npm run lint:prettier

11561
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -35,7 +35,7 @@
"lint:commit": "commitlint", "lint:commit": "commitlint",
"lint:editorconfig": "editorconfig-checker", "lint:editorconfig": "editorconfig-checker",
"lint:markdown": "markdownlint-cli2", "lint:markdown": "markdownlint-cli2",
"lint:javascript": "eslint \"**/*.{js,jsx,ts,tsx}\" -c \"eslintrc.json\"", "lint:eslint": "eslint \"**/*.{js,jsx,ts,tsx}\" -c \"eslintrc.json\"",
"lint:prettier": "prettier \".\" --check --ignore-path \".gitignore\"", "lint:prettier": "prettier \".\" --check --ignore-path \".gitignore\"",
"lint:staged": "lint-staged", "lint:staged": "lint-staged",
"test": "tap", "test": "tap",
@ -45,30 +45,32 @@
"postpublish": "pinst --enable" "postpublish": "pinst --enable"
}, },
"peerDependencies": { "peerDependencies": {
"eslint": "^8.9.0", "eslint": "^8.33.0",
"eslint-plugin-import": "^2.26.0", "eslint-plugin-import": "^2.27.5",
"eslint-plugin-promise": "^6.0.0", "eslint-plugin-promise": "^6.1.1",
"eslint-plugin-unicorn": "^44.0.0" "eslint-plugin-unicorn": "^45.0.2"
}, },
"devDependencies": { "devDependencies": {
"@commitlint/cli": "17.1.2", "@commitlint/cli": "17.4.2",
"@commitlint/config-conventional": "17.1.0", "@commitlint/config-conventional": "17.4.2",
"@types/eslint": "8.4.6", "@tsconfig/strictest": "1.0.2",
"@types/tap": "15.0.7", "@types/eslint": "8.21.0",
"@typescript-eslint/eslint-plugin": "5.39.0", "@types/tap": "15.0.8",
"@typescript-eslint/parser": "5.39.0", "@typescript-eslint/eslint-plugin": "5.51.0",
"editorconfig-checker": "4.0.2", "@typescript-eslint/parser": "5.51.0",
"eslint": "8.24.0", "editorconfig-checker": "5.0.1",
"eslint-plugin-import": "2.26.0", "eslint": "8.33.0",
"eslint-plugin-promise": "6.0.1", "eslint-plugin-import": "2.27.5",
"eslint-plugin-unicorn": "44.0.0", "eslint-plugin-promise": "6.1.1",
"husky": "8.0.1", "eslint-plugin-unicorn": "45.0.2",
"lint-staged": "13.0.3", "husky": "8.0.3",
"markdownlint-cli2": "0.5.1", "lint-staged": "13.1.0",
"markdownlint-cli2": "0.6.0",
"markdownlint-rule-relative-links": "1.1.1",
"pinst": "3.0.0", "pinst": "3.0.0",
"prettier": "2.7.1", "prettier": "2.8.3",
"semantic-release": "19.0.5", "semantic-release": "20.1.0",
"tap": "16.3.0", "tap": "16.3.4",
"typescript": "4.8.4" "typescript": "4.9.5"
} }
} }

View File

@ -1,12 +1,10 @@
{ {
"extends": "@tsconfig/strictest/tsconfig.json",
"compilerOptions": { "compilerOptions": {
"target": "ESNext", "target": "ESNext",
"module": "commonjs", "module": "commonjs",
"lib": ["ESNext"], "lib": ["ESNext"],
"moduleResolution": "node", "moduleResolution": "node",
"rootDir": "./", "rootDir": "./"
"strict": true,
"skipLibCheck": true,
"esModuleInterop": true
} }
} }