Skip to content

Commit

Permalink
Merge pull request #133 from ATIX-AG/feature/js-linting
Browse files Browse the repository at this point in the history
Added js lint target
  • Loading branch information
nadjaheitmann authored Jan 26, 2024
2 parents 60898f6 + 8d3f5e1 commit 5f01957
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 6 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/js_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: JavaScript Testing
on:
push:
branches:
- main
pull_request:
paths:
- 'webpack/**'
- 'package.json'
- 'package-lock.json'
- '.github/workflows/js_tests.yml'
jobs:
test_js:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [12, 14]
steps:
- uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Npm install
run: npm install
- name: Run plugin linter
run: npm run lint
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"test": "test"
},
"scripts": {
"lint": "tfm-lint --plugin -d /webpack",
"test": "echo \"Error: no test specified\" && exit 1",
"create-react-component": "yo react-domain"
},
Expand Down
4 changes: 2 additions & 2 deletions webpack/components/SCCProductPage/SCCProductPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useDispatch } from 'react-redux';
import { translate as __ } from 'foremanReact/common/I18n';
import { useForemanModal } from 'foremanReact/components/ForemanModal/ForemanModalHooks';
import SCCProductView from './components/SCCProductView';
import EmptySccProducts from './EmptySccProducts';
import { EmptySccProducts } from './EmptySccProducts';
import SCCProductPicker from './components/SCCProductPicker';
import SCCProductPickerModal from './components/SCCProductPickerModal';
import { SCCPRODUCTPAGE_SUMMARY_MODAL_ID } from './SCCProductPageConstants';
Expand All @@ -26,7 +26,7 @@ const SCCProductPage = ({
setProductToEdit(productId);
};

const { setModalOpen, setModalClosed } = useForemanModal({
const { setModalOpen } = useForemanModal({
id: SCCPRODUCTPAGE_SUMMARY_MODAL_ID,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const SCCProductPicker = ({
editProductId,
handleSubscribeCallback,
}) => {
const [productItems, setProductItems] = useState(
const [productItems] = useState(
uniq(sccProducts.map((p) => p.product_category))
);
const [selectedProduct, setSelectedProduct] = useState('');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint no-nested-ternary: "off" */
import { foremanUrl } from 'foremanReact/common/helpers';
import { sprintf, translate as __ } from 'foremanReact/common/I18n';

Expand Down Expand Up @@ -88,8 +89,7 @@ const SCCRepoView = ({ sccRepos, sccProductId }) => {
>
{sprintf(
__('Repositories (%s/%s)'),
sccRepos.filter((r) => r.katello_repository_id !== null)
.length,
sccRepos.filter((r) => r.katello_repository_id !== null).length,
sccRepos.length
)}
</BadgeToggle>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ const SCCProductView = ({
};
const sccProductsClone = cloneDeep(sccProducts);
// wrap actual iterator function into anonymous function to pass extra parameters
const [allProducts, setAllProducts] = useState(
const [allProducts] = useState(
sccProductsClone.map((tree) =>
setupTreeViewListItem(tree, true, editProductTree)
)
Expand Down

0 comments on commit 5f01957

Please sign in to comment.