Skip to content

Commit

Permalink
CI linting
Browse files Browse the repository at this point in the history
Signed-off-by: Eric <[email protected]>
  • Loading branch information
mengweieric committed Dec 15, 2023
1 parent f9519e7 commit 1a9620d
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 10 deletions.
7 changes: 7 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules
/data
/build
/target
/.eslintrc.js
/cypress.config.js
!.cypress/
31 changes: 25 additions & 6 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,37 @@ module.exports = {
'@elastic/eslint-config-kibana',
'plugin:@elastic/eui/recommended',
'plugin:react-hooks/recommended',
"eslint:recommended",
"plugin:cypress/recommended",
"plugin:import/recommended",
"prettier"
],
env: {
'cypress/globals': true,
},
plugins: [
'cypress',
],
rules: {
'@osd/eslint/no-restricted-paths': [
'error',
{
basePath: __dirname,
zones: [
{
target: ['(public|server)/**/*'],
from: ['../../packages/**/*','packages/**/*'],
},
],
},
],
// Add cypress specific rules here
'cypress/no-assigning-return-values': 'error',
'cypress/no-unnecessary-waiting': 'error',
'cypress/assertion-before-screenshot': 'warn',
'cypress/no-force': 'warn',
'cypress/no-async-tests': 'error',
},
overrides: [
{
files: ['**/*.{js,ts,tsx}'],
Expand All @@ -32,13 +56,8 @@ module.exports = {
licenses: [LICENSE_HEADER],
},
],
// Add cypress specific rules here
'cypress/no-assigning-return-values': 'error',
'cypress/no-unnecessary-waiting': 'error',
'cypress/assertion-before-screenshot': 'warn',
'cypress/no-force': 'warn',
'cypress/no-async-tests': 'error',
},
},
],
"ignorePatterns": ["**/*.d.ts"]
};
4 changes: 0 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ jobs:
permissions:
contents: read
packages: read
# To report GitHub Actions status checks
statuses: write

steps:
Expand Down Expand Up @@ -53,11 +52,8 @@ jobs:
- name: lint code base
run: |
cd OpenSearch-Dashboards/plugins/dashboards-observability
# Find changed JavaScript/TypeScript files in this PR
git remote -v
git fetch origin main
CHANGED_FILES=$(git diff --name-only --diff-filter=ACMRTUXB origin/main | grep -E "\.(js|ts|tsx)$")
echo "$CHANGED_FILES"
if [ -n "$CHANGED_FILES" ]; then
echo "Linting changed files..."
yarn lint $CHANGED_FILES
Expand Down

0 comments on commit 1a9620d

Please sign in to comment.