From: CodImJun Date: Thu, 1 Aug 2024 06:58:28 +0000 (+0900) Subject: Setting up web dashboard code lint X-Git-Tag: 4.0.0~38 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=e6baabc736924ffc665485ddfe5b510337d924ea;p=portal%2Faiml-dashboard.git Setting up web dashboard code lint Issue-ID: AIMLFW-114 Change-Id: Ia1b24570d7cc169f52107a2ab99dd3c310beb3f9 Signed-off-by: CodImJun --- diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..d0b9be2 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,13 @@ +{ + "printWidth": 120, + "tabWidth": 2, + "useTabs": false, + "semi": true, + "singleQuote": true, + "jsxSingleQuote": true, + "trailingComma": "all", + "bracketSpacing": true, + "arrowParens": "avoid", + "proseWrap": "never", + "endOfLine": "auto" +} diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..8dd3612 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,37 @@ +import globals from 'globals'; +import pluginJs from '@eslint/js'; +import pluginReact from 'eslint-plugin-react'; +import pluginPrettier from 'eslint-plugin-prettier'; + +export default [ + { + files: ['**/*.{js,mjs,cjs,jsx}'], + languageOptions: { + globals: globals.browser, + }, + plugins: { + react: pluginReact, + prettier: pluginPrettier, + }, + rules: { + 'no-console': 'warn', + 'prettier/prettier': 'error', + eqeqeq: 'error', + curly: 'error', + 'no-eval': 'error', + 'no-implied-eval': 'error', + 'no-cond-assign': ['error', 'always'], + 'no-constant-condition': 'error', + 'no-debugger': 'error', + 'array-bracket-spacing': ['error', 'never'], + 'block-spacing': ['error', 'always'], + 'brace-style': ['error', '1tbs'], + camelcase: ['error', { properties: 'always' }], + 'comma-dangle': ['error', 'always-multiline'], + 'react/jsx-uses-react': 'off', + 'react/react-in-jsx-scope': 'off', + }, + extends: ['eslint:recommended', 'plugin:react/recommended', 'plugin:prettier/recommended', 'prettier'], + }, + pluginJs.configs.recommended, +]; diff --git a/package.json b/package.json index 6027cec..b5a7c0e 100644 --- a/package.json +++ b/package.json @@ -41,5 +41,14 @@ "last 1 firefox version", "last 1 safari version" ] + }, + "devDependencies": { + "@eslint/js": "^9.8.0", + "eslint": "^9.8.0", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-prettier": "^5.2.1", + "eslint-plugin-react": "^7.35.0", + "globals": "^15.8.0", + "prettier": "^3.3.3" } }