Skip to content

Commit

Permalink
fixup lint and commits
Browse files Browse the repository at this point in the history
  • Loading branch information
Manisha15 committed Jul 11, 2024
1 parent 953c158 commit e895a39
Show file tree
Hide file tree
Showing 16 changed files with 149 additions and 38,453 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Ignore all files except webpack directory
**/*.js
!webpack/**/*.js
4 changes: 0 additions & 4 deletions .eslintrc

This file was deleted.

This file was deleted.

3 changes: 3 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: ['@theforeman/builder/babel'],
};
12 changes: 12 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import globals from "globals";
import pluginJs from "@eslint/js";
import pluginReactConfig from "eslint-plugin-react/configs/recommended.js";


export default [
{files: ["**/*.{js,mjs,cjs,jsx}"]},
{ languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } } },
{languageOptions: { globals: globals.browser }},
pluginJs.configs.recommended,
pluginReactConfig,
];
11 changes: 11 additions & 0 deletions global_test_setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// runs before each test to make sure console.error output will
// fail a test (i.e. default PropType missing). Check the error
// output and traceback for actual error.
global.console.error = (error, stack) => {
/* eslint-disable-next-line no-console */
if (stack) console.log(stack); // Prints out original stack trace
throw new Error(error);
};

// Increase jest timeout as some tests using multiple http mocks can time out on CI systems.
jest.setTimeout(10000);
35 changes: 35 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Find where foreman is located
const { foremanRelativePath, foremanLocation } = require('@theforeman/find-foreman');
const foremanReactRelative = 'webpack/assets/javascripts/react_app';
const foremanFull = foremanLocation();
const foremanReactFull = foremanRelativePath(foremanReactRelative);

module.exports = {
testURL: 'http://localhost/',
setupFiles: [
'./webpack/test_setup.js',
],
setupFilesAfterEnv: [
'./webpack/global_test_setup.js',
'@testing-library/jest-dom'
],
testPathIgnorePatterns: [
'/node_modules/',
'<rootDir>/foreman/',
'<rootDir>/.+fixtures.+',
'<rootDir>/engines',
],
moduleDirectories: [
`${foremanFull}/node_modules`,
`${foremanFull}/node_modules/@theforeman/vendor-core/node_modules`,
'node_modules',
'webpack/test-utils',
],
modulePathIgnorePatterns: [
'<rootDir>/foreman/',
],
moduleNameMapper: {
'^.+\\.(css|scss)$': 'identity-obj-proxy',
'^foremanReact(.*)$': `${foremanReactFull}/$1`,
},
};
8 changes: 8 additions & 0 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"compilerOptions": {
"target": "es6",
"paths": {
"foremanReact/*": ["../foreman/webpack/assets/javascripts/react_app/*"]
}
}
}
Loading

0 comments on commit e895a39

Please sign in to comment.