diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..3bf18aa --- /dev/null +++ b/.eslintignore @@ -0,0 +1,9 @@ +build/ +node_modules/ +config-overrides.js +src/configureMonaco.js +src/monaco-worker-loader-proxy.dev.js +src/monaco-worker-loader-proxy.js +src/registerServiceWorker.js +src/core/generated-parser/ +src/web-socket-js/ diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..82c08d8 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,71 @@ +{ + "env": { + "browser": true, + "node": true, + "jasmine": true, + "es6": true + }, + "extends": [ + "eslint:recommended", + "google", + "plugin:import/errors", + "plugin:jsx-a11y/recommended", + "plugin:react/recommended", + "plugin:react/jsx-runtime", + "plugin:react-hooks/recommended" + ], + "parser": "@babel/eslint-parser", + "parserOptions": { + "ecmaVersion": 2021, + "sourceType": "module", + "babelOptions": { + "presets": ["@babel/preset-react"] + } + }, + "plugins": [ + "react", + "import", + "jsx-a11y" + ], + "rules": { + "camelcase": "off", + "guard-for-in": "warn", + "import/default": "off", + "import/export": "off", + "import/namespace": "off", + "indent": ["error", 4, {"SwitchCase": 1}], + "jsx-a11y/click-events-have-key-events": "off", + "jsx-a11y/no-noninteractive-element-interactions": "off", + "jsx-a11y/no-static-element-interactions": "off", + "max-len": "off", + "new-cap": "off", + "no-case-declarations": "off", + "no-constant-condition": "off", + "no-control-regex": "off", + "no-invalid-this": "off", + "no-prototype-builtins": "off", + "no-unused-vars": ["error", {"varsIgnorePattern": "React", "argsIgnorePattern": "^_"}], + "object-curly-spacing": ["error", "never"], + "prefer-promise-reject-errors": "off", + "quotes": ["error", "double"], + "react/prop-types": "off", + "react/no-unescaped-entities": "off", + "require-jsdoc": "off", + "valid-jsdoc": "off" + }, + "overrides": [ + { + "files": ["*Constants.js", "*Constant.js", "*Config.js"], + "rules": {"camelcase": "off"} + }, + { + "files": ["*.test.js", "src/ui/RulePad/rulePad.js"], + "rules": {"max-len": "off"} + } + ], + "settings": { + "react": { + "version": "detect" + } + } +} diff --git a/.github/workflows/eslint.yml b/.github/workflows/eslint.yml new file mode 100644 index 0000000..27b5608 --- /dev/null +++ b/.github/workflows/eslint.yml @@ -0,0 +1,26 @@ +name: ESLint + +on: + push: + branches: + - 'main' + pull_request: + branches: + - 'main' + +jobs: + eslint: + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-node@v2 + with: + node-version: '18' + + - name: Install ESLint + run: npm install eslint@8.10.0 @microsoft/eslint-formatter-sarif@2.1.7 + + - name: Run ESLint + run: npx eslint . --ext .js --config .eslintrc.json diff --git a/babel.config.json b/babel.config.json new file mode 100644 index 0000000..18a5732 --- /dev/null +++ b/babel.config.json @@ -0,0 +1,12 @@ +{ + "presets": [ + [ + "@babel/env", + { + "targets": { + "node": "12" + } + } + ] + ] +} diff --git a/package.json b/package.json index a4524c0..23cbf6e 100644 --- a/package.json +++ b/package.json @@ -34,8 +34,18 @@ "wink-pos-tagger": "1.5.0" }, "devDependencies": { + "@babel/eslint-parser": "^7.24.7", + "@babel/plugin-proposal-private-property-in-object": "7.21.11", + "@eslint/js": "9.5.0", + "eslint": "^7.32.0", + "eslint-config-google": "^0.14.0", + "eslint-plugin-import": "2.29.1", + "eslint-plugin-jsx-a11y": "6.9.0", + "eslint-plugin-react": "7.34.3", + "eslint-plugin-react-hooks": "4.6.2", "gh-pages": "3.1.0", - "jasmine": "^5.1.0", + "globals": "15.6.0", + "jasmine": "5.1.0", "react-app-rewired": "2.1.8", "react-scripts": "4.0.3" },