Skip to content

Commit

Permalink
Simplified eslint config
Browse files Browse the repository at this point in the history
  • Loading branch information
midlik committed Aug 20, 2024
1 parent 481ab30 commit 18eb7ff
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 107 deletions.
137 changes: 38 additions & 99 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,107 +1,46 @@
import globals from "globals";
import stylisticEslintPlugin from "@stylistic/eslint-plugin";
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import tsParser from "@typescript-eslint/parser";
import eslint from '@eslint/js';
import tsEslint from 'typescript-eslint';
import stylisticEslint from '@stylistic/eslint-plugin';

export default [{
languageOptions: {
globals: {
...globals.browser,
...globals.node,
},
ecmaVersion: 2018,
sourceType: "module",
parserOptions: {
ecmaFeatures: {
impliedStrict: true,
},
},
},

rules: {
"indent": "off",
"arrow-parens": ["off", "as-needed"],
"brace-style": "off",
"comma-spacing": "off",
"space-infix-ops": "off",
"comma-dangle": "off",
"eqeqeq": ["error", "smart"],
"import/order": "off",
"no-eval": "warn",
"no-new-wrappers": "warn",
"no-trailing-spaces": "error",
"no-unsafe-finally": "warn",
"no-var": "error",
"spaced-comment": "error",
"semi": "warn",
"no-restricted-syntax": ["error", {
selector: "ExportDefaultDeclaration",
message: "Default exports are not allowed",
}],
"no-throw-literal": "error",
"key-spacing": "error",
"object-curly-spacing": ["error", "always"],
"array-bracket-spacing": "error",
"space-in-parens": "error",
"computed-property-spacing": "error",
"prefer-const": ["error", {
destructuring: "all",
ignoreReadBeforeAssign: false,
}],
"space-before-function-paren": "off",
"func-call-spacing": "off",
"no-multi-spaces": "error",
"block-spacing": "error",
"keyword-spacing": "off",
"space-before-blocks": "error",
"semi-spacing": "error",
},
}, {
files: ["**/*.ts", "**/*.tsx"],
export default tsEslint.config(
eslint.configs.recommended,
...tsEslint.configs.recommended,
...tsEslint.configs.stylistic,
{
plugins: {
'@stylistic': stylisticEslint,
},
rules:{
'prefer-const': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/consistent-indexed-object-style': 'off',
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/consistent-type-definitions': 'off',
'@typescript-eslint/no-unused-expressions': 'off',
'@typescript-eslint/no-empty-object-type': 'off',

plugins: {
"@typescript-eslint": typescriptEslint,
"@stylistic": stylisticEslintPlugin,
},

languageOptions: {
parser: tsParser,
ecmaVersion: 5,
sourceType: "module",
parserOptions: {
project: ["tsconfig.json", "tsconfig-eslint.json"],
},
},

rules: {
"@stylistic/indent": ["error", 4],
"@stylistic/member-delimiter-style": ["off", {
multiline: {
delimiter: "none",
requireLast: true,
},
singleline: {
delimiter: "semi",
requireLast: false,
},
}],
"@stylistic/quotes": ["error", "single", {
avoidEscape: true,
allowTemplateLiterals: true,
'@stylistic/indent': ['error', 4],
'@stylistic/quotes': ['error', 'single', {
avoidEscape: true,
allowTemplateLiterals: true,
}],
"@stylistic/semi": ["off", null],
"@stylistic/type-annotation-spacing": "error",
"@stylistic/brace-style": ["error", "1tbs", {
'@stylistic/semi': 'off',
'@stylistic/type-annotation-spacing': 'error',
'@stylistic/brace-style': ['error', '1tbs', {
allowSingleLine: true,
}],
"@stylistic/comma-spacing": "error",
"@stylistic/space-infix-ops": "error",
"@stylistic/space-before-function-paren": ["error", {
anonymous: "always",
named: "never",
asyncArrow: "always",
'@stylistic/comma-spacing': 'error',
'@stylistic/space-infix-ops': 'error',
'@stylistic/space-before-function-paren': ['error', {
anonymous: 'always',
named: 'never',
asyncArrow: 'always',
}],
"@stylistic/func-call-spacing": ["error"],
"@stylistic/keyword-spacing": ["error"],
'@stylistic/func-call-spacing': ['error'],
'@stylistic/keyword-spacing': ['error'],
},
},
}];
);
30 changes: 26 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,19 @@
"homepage": "https://github.com/PDBeurope/pdb-images#readme",
"devDependencies": {
"@stylistic/eslint-plugin": "^2.6.4",
"@stylistic/eslint-plugin-ts": "^2.6.4",
"@types/argparse": "^2.0.16",
"@types/gl": "^6.0.2",
"@types/jest": "^29.5.0",
"@types/jpeg-js": "^0.3.7",
"@types/pngjs": "^6.0.1",
"@types/react": "^18.0.9",
"@types/react-dom": "^18.0.5",
"@typescript-eslint/eslint-plugin": "^8.2.0",
"@typescript-eslint/parser": "^8.2.0",
"eslint": "^9.9.0",
"globals": "^15.9.0",
"jest": "^29.5.0",
"ts-jest": "^29.1.0",
"typescript": "^5.5.4"
"typescript": "^5.5.4",
"typescript-eslint": "^8.2.0"
},
"dependencies": {
"argparse": "^2.0.1",
Expand Down

0 comments on commit 18eb7ff

Please sign in to comment.