Skip to content

Commit

Permalink
Fixes #37639 - Use own lint instead of @theforeman
Browse files Browse the repository at this point in the history
  • Loading branch information
MariaAga committed Jul 15, 2024
1 parent 7ba942b commit 915675e
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 8 deletions.
23 changes: 20 additions & 3 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
{
"plugins": [
"@theforeman/foreman",
"spellcheck",
"@theforeman/rules"
],
"extends": "plugin:@theforeman/foreman/core",
"rules": {
"spellcheck/spell-checker": [
"warn",
Expand Down Expand Up @@ -178,6 +176,7 @@
"unprocessable",
"unselect",
"unstyled",
"utf8",
"virtualization",
"vms",
"vmware",
Expand All @@ -194,7 +193,25 @@
"minLength": 3
}
],
"@theforeman/rules/require-ouiaid": ["error"],
"@theforeman/rules/require-ouiaid": [
"error"
],
"import/no-extraneous-dependencies": "off",
"import/no-unresolved": [
"error",
{
"ignore": [
"foremanReact/.*"
]
}
],
"import/extensions": [
"error",
{
"ignore": [
"foremanReact/.*"
]
}
]
}
}
2 changes: 0 additions & 2 deletions .github/workflows/js_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ jobs:
run: npm ci --no-audit
- name: Run linter
run: npm run lint
- name: Run custom eslint rules Spellcheck (only warnings) and missing ouia-ids
run: npm run lint:custom
- name: Run tests
run: npm run test
- name: Publish Coveralls
Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
"node": ">=14.0.0 <21.0.0"
},
"scripts": {
"lint": "tfm-lint",
"lint:custom": "eslint ./webpack",
"lint": "eslint ./webpack ./script -c ./script/lint_core_config.js",
"foreman-js:link": "./script/npm_link_foreman_js.sh",
"postlint": "./script/npm_lint_plugins.js",
"test": "npx jest --setupFilesAfterEnv ./global_test_setup.js ./core_test_setup.js --testPathIgnorePatterns '/node_modules/' '<rootDir>/.+fixtures.+' --config ./webpack/jest.config.js ",
Expand All @@ -36,7 +35,6 @@
"@testing-library/react": "^10.0.2",
"@testing-library/react-hooks": "^3.4.2",
"@theforeman/builder": "^13.1.0",
"@theforeman/eslint-plugin-foreman": "^13.1.0",
"@theforeman/eslint-plugin-rules": "^13.1.0",
"@theforeman/vendor-core": "^13.1.0",
"@theforeman/vendor-dev": "^13.1.0",
Expand All @@ -57,6 +55,10 @@
"enzyme-to-json": "^3.4.3",
"eslint": "^6.7.2",
"eslint-plugin-spellcheck": "0.0.17",
"eslint-plugin-patternfly-react": "0.2.0",
"eslint-plugin-jquery": "^1.5.1",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-react-hooks": "^2.1.1",
"graphql": "^15.5.0",
"identity-obj-proxy": "^3.0.0",
"jest": "^26.4.0",
Expand Down
59 changes: 59 additions & 0 deletions script/lint_core_config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
module.exports = {
plugins: ['patternfly-react', 'promise', 'jquery', 'react-hooks'],
extends: [
'plugin:patternfly-react/recommended',
require.resolve('@theforeman/vendor-dev/eslint.extends.js'),
'plugin:jquery/deprecated',
],
rules: {
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'max-lines': [
'error',
{
max: 300,
skipBlankLines: true,
skipComments: true,
},
],
'no-restricted-syntax': [
'error',
{
selector: 'ForInStatement',
message:
'for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.',
},
{
selector: 'LabeledStatement',
message:
'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.',
},
{
selector: 'WithStatement',
message:
'`with` is disallowed in strict mode because it makes code impossible to predict and optimize.',
},
],
'promise/prefer-await-to-then': 'error',
'prettier/prettier': [
'error',
{
singleQuote: true,
trailingComma: 'es5',
},
],
'import/no-unresolved': [
'error',
{
ignore: ['foremanReact/.*'],
},
],
'import/extensions': [
'error',
{
ignore: ['foremanReact/.*'],
},
],
'import/no-extraneous-dependencies': 'off',
},
};

0 comments on commit 915675e

Please sign in to comment.