Skip to content

Commit

Permalink
IBX-9109: Added support for TypeScript
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasOsti committed Oct 22, 2024
1 parent edf236a commit bf0a4c4
Show file tree
Hide file tree
Showing 2 changed files with 116 additions and 51 deletions.
164 changes: 113 additions & 51 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
module.exports = {
plugins: ["react"],
extends: ["eslint:recommended", "plugin:react/recommended"],
settings: {
react: {
version: "16.x"
Expand All @@ -22,54 +20,118 @@ module.exports = {
sourceType: "module",
ecmaVersion: 12
},
rules: {
"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": {
"array": false,
"object": true
},
"AssignmentExpression": {
"array": false,
"object": false
overrides: [
{
files: ["*.js"],
plugins: ["react"],
extends: ["eslint:recommended", "plugin:react/recommended"],
rules: {
"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": {
"array": false,
"object": true
},
"AssignmentExpression": {
"array": false,
"object": false
}
}, { 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"],
"react/jsx-closing-bracket-location": "error",
"react/jsx-closing-tag-location": "error",
"react/jsx-curly-spacing": "error",
"react/jsx-equals-spacing": "error",
"react/jsx-first-prop-new-line": "error",
"react/jsx-key": "error",
"react/jsx-no-duplicate-props": "error",
"react/no-array-index-key": "error",
"react/no-typos": "error",
"react/require-default-props": "error",
"react/self-closing-comp": "error",
"react/style-prop-object": "error",
}
}, { 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"],
"react/jsx-closing-bracket-location": "error",
"react/jsx-closing-tag-location": "error",
"react/jsx-curly-spacing": "error",
"react/jsx-equals-spacing": "error",
"react/jsx-first-prop-new-line": "error",
"react/jsx-key": "error",
"react/jsx-no-duplicate-props": "error",
"react/no-array-index-key": "error",
"react/no-typos": "error",
"react/require-default-props": "error",
"react/self-closing-comp": "error",
"react/style-prop-object": "error"
}
},
{
files: ["*.ts", "*.tsx"],
plugins: ["react", "@typescript-eslint"],
extends: ["plugin:@typescript-eslint/recommended"],
rules: {
"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": {
"array": false,
"object": true
},
"AssignmentExpression": {
"array": false,
"object": false
}
}, { 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"],
"react/jsx-closing-bracket-location": "error",
"react/jsx-closing-tag-location": "error",
"react/jsx-curly-spacing": "error",
"react/jsx-equals-spacing": "error",
"react/jsx-first-prop-new-line": "error",
"react/jsx-key": "error",
"react/jsx-no-duplicate-props": "error",
"react/no-array-index-key": "error",
"react/no-typos": "error",
"react/require-default-props": "error",
"react/self-closing-comp": "error",
"react/style-prop-object": "error",
"react/require-default-props": "off",
"@typescript-eslint/no-require-imports": "off"
}
}
]
};
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"repository": "[email protected]:ibexa/eslint-config-ibexa.git",
"private": true,
"dependencies": {
"@typescript-eslint/eslint-plugin": "^8.10.0",
"@typescript-eslint/parser": "^8.10.0",
"typescript": "^5.6.3",
"eslint": "8.55",
"eslint-plugin-react": "7.33.2",
"prettier": "3.1"
Expand Down

0 comments on commit bf0a4c4

Please sign in to comment.