Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump rules #13

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
yarn.lock
85 changes: 76 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
const stylistic = require('@stylistic/eslint-plugin');

const baseRules = {
"array-callback-return": "error",
"eol-last": "error",
"no-console": ["error", { allow: ["warn", "error"] }],
"no-duplicate-imports": "error",
"no-else-return": "error",
"no-extra-boolean-cast": "off",
"no-multi-spaces": "error",
"no-multiple-empty-lines": ["error", { "max": 1, "maxBOF": 0, "maxEOF": 0 }],
"no-nested-ternary": "error",
"no-shadow": "error",
"no-template-curly-in-string": "error",
"no-trailing-spaces": "error",
"no-unreachable-loop": "error",
"no-unsafe-optional-chaining": "error",
"no-useless-concat": "error",
"no-var": "error",
"object-curly-spacing": ["error", "always"],
"prefer-const": "error",
"prefer-destructuring": ["error", {
"VariableDeclarator": {
Expand All @@ -29,9 +26,7 @@ const baseRules = {
}, { enforceForRenamedProperties: false }],
"prefer-object-spread": "error",
"prefer-template": "error",
"quotes": ["error", "single", { allowTemplateLiterals: true }],
"radix": "error",
"semi-spacing": "error",
"react/button-has-type": "error",
"react/default-props-match-prop-types": "error",
"react/jsx-boolean-value": ["error", "always"],
Expand All @@ -47,6 +42,77 @@ const baseRules = {
"react/require-default-props": "error",
"react/self-closing-comp": "error",
"react/style-prop-object": "error",
"@stylistic/indent": "off", // prettier conflict
"@stylistic/jsx-indent-props": "off", // prettier conflict
"@stylistic/semi": "off", // prettier conflict
"@stylistic/arrow-parens": "off", // prettier conflict
"@stylistic/spaced-comment": "off", // @Desc conflict
"@stylistic/brace-style": ["error", "1tbs"],
"@stylistic/quote-props": ["error", "as-needed"],
"@stylistic/multiline-ternary": "off", // prettier conflict
"@stylistic/operator-linebreak": "off", // prettier conflict, unfortunatelly
"@stylistic/jsx-one-expression-per-line": "off",
"@stylistic/jsx-curly-newline": "off", // prettier conflict
};

const advancedRules = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const advancedRules = {
const strictRules = {

WDYT? convention similar to strict-type-checked

"plugin:@typescript-eslint/strict-type-checked",

"camelcase": "error",
"curly": "error",
"default-case": "error",
"default-case-last": "error",
"dot-notation": "error",
"eqeqeq": "error",
"func-style": ["error", "expression"],
"guard-for-in": "error",
"id-length": ["error", { "min": 2 }],
"max-classes-per-file": "error",
"max-depth": ["error", { "max": 4 }],
"max-lines": ["error", { "max": 300 }],
"max-lines-per-function": ["error", { "max": 50 }],
"no-alert": "error",
"no-array-constructor": "error",
"no-await-in-loop": "error",
"no-bitwise": "error",
"no-caller": "error",
"no-eval": "error",
"no-extend-native": "error",
"no-extra-label": "error",
"no-implicit-globals": "error",
"no-lone-blocks": "error",
"no-lonely-if": "error",
"no-loop-func": "error",
"no-magic-numbers": "error",
"no-multi-assign": "error",
"no-multi-str": "error",
"no-negated-condition": "error",
"no-new": "error",
"no-new-wrappers": "error",
"no-param-reassign": ["error", { "props": true }],
"no-promise-executor-return": "error",
"no-return-assign": "error",
"no-self-compare": "error",
"no-sequences": "error",
"no-throw-literal": "error",
"no-unmodified-loop-condition": "error",
"no-unneeded-ternary": "error",
"no-unused-expressions": "error",
"no-useless-computed-key": "error",
"no-useless-constructor": "error",
"no-useless-return": "error",
"object-shorthand": "error",
"prefer-arrow-callback": "error",
"prefer-object-has-own": "error",
"prefer-promise-reject-errors": "error",
"require-atomic-updates": "error",
"require-await": "error",
"sort-imports": ["error", { "allowSeparatedGroups": true }],
"sort-keys": "error",
"@stylistic/function-call-spacing": "error",
"@stylistic/jsx-pascal-case": "error",
"@stylistic/jsx-props-no-multi-spaces": "error",
"@stylistic/jsx-self-closing-comp": "error",
"@stylistic/jsx-sort-props": "error",
"@stylistic/switch-colon-spacing": "error",
};

module.exports = {
Expand Down Expand Up @@ -74,8 +140,8 @@ module.exports = {
overrides: [
{
files: ["*.js"],
plugins: ["react"],
extends: ["eslint:recommended", "plugin:react/recommended"],
plugins: ["react", "@stylistic"],
extends: ["eslint:recommended", "plugin:react/recommended", "plugin:@stylistic/recommended-extends"],
rules: baseRules
},
{
Expand All @@ -90,6 +156,7 @@ module.exports = {
],
rules: {
...baseRules,
...advancedRules,
...{
"@typescript-eslint/no-unsafe-type-assertion": "error",
"@typescript-eslint/no-redundant-type-constituents": "off",
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
"repository": "[email protected]:ibexa/eslint-config-ibexa.git",
"private": true,
"dependencies": {
"@stylistic/eslint-plugin": "2.12.0",
"@typescript-eslint/eslint-plugin": "8.16.0",
"@typescript-eslint/parser": "8.16.0",
"typescript": "5.6.3",
"eslint": "8.55",
"eslint-plugin-react": "7.33.2",
"prettier": "3.1"
"prettier": "3.1",
"typescript": "5.6.3"
},
"exports": {
".": "./index.js",
Expand Down