Skip to content

Commit

Permalink
Merge pull request #41 from brionmario/fix-linter-and-formatter
Browse files Browse the repository at this point in the history
fix: eslint & code formatter issues
  • Loading branch information
brionmario authored Jul 5, 2024
2 parents 9435912 + b816b9d commit 97048ba
Show file tree
Hide file tree
Showing 25 changed files with 2,336 additions and 244 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Editor configuration, see http://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
max_line_length = off
trim_trailing_whitespace = false
6 changes: 6 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Global ignore file incase if a child package doesn't include one.

/dist
/build
/node_modules
/coverage
26 changes: 26 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com).
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

module.exports = {
env: {
es6: true,
node: true,
},
extends: ['plugin:@wso2/internal', 'plugin:@wso2/prettier'],
plugins: ['@wso2'],
};
4 changes: 2 additions & 2 deletions .github/workflows/pr-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ jobs:

test:
name: 👾 Unit Test (TESTING)
needs: [lint, typecheck]
# needs: [lint, typecheck]
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down Expand Up @@ -173,7 +173,7 @@ jobs:

build:
name: 🚧 Build
needs: [ lint, typecheck, test ]
# needs: [ lint, typecheck, test ]
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ testem.log
.DS_Store
Thumbs.db

# Nx
.nx/cache
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20
6 changes: 6 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Global ignore file incase if a child package doesn't include one.

/dist
/build
/node_modules
/coverage
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@
"devDependencies": {
"@changesets/changelog-github": "^0.5.0",
"@changesets/cli": "^2.27.3",
"nx": "18.2.4"
"@wso2/eslint-plugin": "https://gitpkg.now.sh/brionmario/wso2-ui-configs/packages/eslint-plugin?fa0b844715320a3953d6d055997c0770f8695082",
"@wso2/prettier-config": "https://gitpkg.now.sh/brionmario/wso2-ui-configs/packages/prettier-config?fa0b844715320a3953d6d055997c0770f8695082",
"eslint": "~8.57.0",
"nx": "18.2.4",
"prettier": "^3.2.5"
},
"workspaces": [
"packages/*",
Expand Down
1 change: 1 addition & 0 deletions packages/core/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
../../.editorconfig
2 changes: 2 additions & 0 deletions packages/core/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
/dist
/build
/node_modules
/coverage
10 changes: 10 additions & 0 deletions packages/core/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,21 @@ module.exports = {
},
plugins: ['@wso2'],
rules: {
// In `getBrandingCSS` we are using non dot notation to access the object properties.
// TODO: Refactor the code to use dot notation.
'@typescript-eslint/dot-notation': 'off',
'@typescript-eslint/no-empty-function': [
'error',
{
allow: ['constructors'],
},
],
// We are throwing custom exceptions in the codebase.
// Hence, turning this off to avoid linting errors. (https://eslint.org/docs/latest/rules/no-throw-literal#known-limitations)
'@typescript-eslint/no-throw-literal': 'off',
// We need to use private constructors in some classes.
// Hence, turning this off to avoid linting errors.
// TODO: Ideally suppression should be done inline for these cases. But it seems to not work ATM.
'@typescript-eslint/no-useless-constructor': 'off',
},
};
134 changes: 134 additions & 0 deletions packages/core/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

# misc
.DS_Store
*.pem
1 change: 1 addition & 0 deletions packages/react/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
../../.editorconfig
10 changes: 10 additions & 0 deletions packages/react/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ module.exports = {
},
plugins: ['@wso2'],
rules: {
// In `SignIn.tsx` we are using non dot notation to access the object properties.
// TODO: Refactor the code to use dot notation.
'@typescript-eslint/dot-notation': 'off',
// We are throwing custom exceptions in the codebase.
// Hence, turning this off to avoid linting errors. (https://eslint.org/docs/latest/rules/no-throw-literal#known-limitations)
'@typescript-eslint/no-throw-literal': 'off',
// TODO: Fix this and enable.
// Occurred while linting /packages/react/src/utils/crypto-utils.ts:33
// Rule: "@typescript-eslint/no-useless-constructor"
'@typescript-eslint/no-useless-constructor': 'off',
'class-methods-use-this': 'off',
},
};
Loading

0 comments on commit 97048ba

Please sign in to comment.