Skip to content

Commit

Permalink
use stylistic in more cases
Browse files Browse the repository at this point in the history
  • Loading branch information
iamnapo committed Apr 5, 2024
1 parent 652739f commit d24552f
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 32 deletions.
58 changes: 49 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,55 @@ module.exports = {
plugins: ["ava", "unicorn", "@stylistic"],
reportUnusedDisableDirectives: true,
rules: {
"@stylistic/brace-style": "error",
"@stylistic/comma-dangle": ["error", "always-multiline"],
"@stylistic/comma-spacing": "error",
"@stylistic/func-call-spacing": "error",
"@stylistic/function-paren-newline": ["error", "consistent"],
"@stylistic/indent": ["error", "tab", { SwitchCase: 1 }],
"@stylistic/keyword-spacing": "error",
"@stylistic/lines-between-class-members": "error",
"@stylistic/max-len": [
"error",
{
code: 130,
tabWidth: 2,
ignoreUrls: true,
ignoreRegExpLiterals: true,
ignoreStrings: true,
ignoreTemplateLiterals: true,
},
],
"@stylistic/no-extra-semi": "error",
"@stylistic/no-mixed-operators": [
"error",
{
groups: [
["%", "**"],
["%", "+"],
["%", "-"],
["%", "*"],
["%", "/"],
["/", "*"],
["&", "|", "<<", ">>", ">>>"],
["==", "!=", "===", "!=="],
["&&", "||"],
],
allowSamePrecedence: false,
},
],
"@stylistic/no-multiple-empty-lines": ["error", { max: 1 }],
"@stylistic/object-curly-spacing": ["error", "always"],
"@stylistic/padding-line-between-statements": [
"error",
{ blankLine: "always", prev: "multiline-block-like", next: "*" },
],
"@stylistic/quotes": ["error", "double"],
"@stylistic/semi": "error",
"@stylistic/space-before-blocks": "error",
"@stylistic/space-before-function-paren": ["error", { anonymous: "always", named: "never", asyncArrow: "always" }],
"@stylistic/space-infix-ops": "error",
"@stylistic/wrap-iife": ["error", "inside", { functionPrototypeMethods: true }],
"array-callback-return": ["error", { allowImplicit: true }],
"class-methods-use-this": "off",
"func-names": ["error", "never"],
Expand Down Expand Up @@ -39,14 +88,5 @@ module.exports = {
"unicorn/no-null": "off",
"unicorn/prefer-switch": ["error", { emptyDefaultCase: "do-nothing-comment" }],
"unicorn/prevent-abbreviations": "off",
"@stylistic/function-paren-newline": ["error", "consistent"],
"@stylistic/indent": ["error", "tab", { SwitchCase: 1 }],
"@stylistic/max-len": ["error", { code: 130, tabWidth: 2, ignoreUrls: true, ignoreRegExpLiterals: true, ignoreStrings: true, ignoreTemplateLiterals: true }],
"@stylistic/no-mixed-operators": "error",
"@stylistic/no-multiple-empty-lines": ["error", { max: 1 }],
"@stylistic/padding-line-between-statements": ["error", { blankLine: "always", prev: "multiline-block-like", next: "*" }],
"@stylistic/quotes": ["error", "double"],
"@stylistic/space-before-function-paren": ["error", { anonymous: "always", named: "never", asyncArrow: "always" }],
"@stylistic/wrap-iife": ["error", "inside", { functionPrototypeMethods: true }],
},
};
37 changes: 26 additions & 11 deletions react.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
/** @type {import("eslint").Linter.Config} */
module.exports = {
extends: [
"airbnb",
"airbnb/hooks",
"plugin:react/recommended",
"plugin:jsx-a11y/recommended",
"./index",
],
extends: ["airbnb", "airbnb/hooks", "plugin:react/recommended", "plugin:jsx-a11y/recommended", "./index"],
env: {
browser: true,
},
Expand All @@ -31,16 +25,37 @@ module.exports = {
"react/jsx-curly-brace-presence": ["error", { props: "never", children: "always" }],
"react/jsx-indent": ["error", "tab", { checkAttributes: true, indentLogicalExpressions: true }],
"react/jsx-indent-props": ["error", "tab"],
"react/jsx-key": ["error", { checkFragmentShorthand: true, checkKeyMustBeforeSpread: true, warnOnDuplicates: true }],
"react/jsx-key": [
"error",
{
checkFragmentShorthand: true,
checkKeyMustBeforeSpread: true,
warnOnDuplicates: true,
},
],
"react/jsx-no-duplicate-props": ["error", { ignoreCase: false }],
"react/jsx-no-useless-fragment": "error",
"react/jsx-props-no-spreading": "off",
"react/jsx-sort-props": ["error", { callbacksLast: true, shorthandFirst: true, noSortAlphabetically: true, reservedFirst: true }],
"react/jsx-sort-props": [
"error",
{
callbacksLast: true,
shorthandFirst: true,
noSortAlphabetically: true,
reservedFirst: true,
},
],
"react/jsx-uses-react": "off",
"react/no-array-index-key": "off",
"react/no-unstable-nested-components": ["error", { allowAsProps: true }],
"react/react-in-jsx-scope": "off",
"react/require-default-props": ["error", { forbidDefaultForRequired: true, ignoreFunctionalComponents: true }],
"unicorn/filename-case": ["error", { cases: { kebabCase: true, pascalCase: true } }],
"react/require-default-props": [
"error",
{
forbidDefaultForRequired: true,
ignoreFunctionalComponents: true,
},
],
"unicorn/filename-case": ["error", { cases: [Object] }],
},
};
12 changes: 0 additions & 12 deletions typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,7 @@ module.exports = {
},
rules: {
"no-void": ["error", { allowAsStatement: true }],
"@stylistic/brace-style": "error",
"@stylistic/comma-dangle": ["error", "always-multiline"],
"@stylistic/comma-spacing": "error",
"@stylistic/func-call-spacing": "error",
"@stylistic/keyword-spacing": "error",
"@stylistic/lines-between-class-members": "error",
"@stylistic/member-delimiter-style": ["error", { multiline: { delimiter: "semi", requireLast: true }, singleline: { delimiter: "semi", requireLast: false } }],
"@stylistic/no-extra-semi": "error",
"@stylistic/object-curly-spacing": ["error", "always"],
"@stylistic/semi": "error",
"@stylistic/space-before-blocks": "error",
"@stylistic/space-before-function-paren": "error",
"@stylistic/space-infix-ops": "error",
"@stylistic/type-annotation-spacing": "error",
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
"@typescript-eslint/consistent-type-imports": [
Expand Down

0 comments on commit d24552f

Please sign in to comment.