-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update linting to use helix rules and setup workflows to test (#8)
- Loading branch information
Showing
11 changed files
with
1,446 additions
and
1,320 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.vscode/* | ||
coverage/* | ||
dist/* | ||
!.releaserc.js | ||
test/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,19 @@ | ||
/* | ||
* Copyright 2024 Adobe. All rights reserved. | ||
* This file is licensed 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 REPRESENTATIONS | ||
* OF ANY KIND, either express or implied. See the License for the specific language | ||
* governing permissions and limitations under the License. | ||
*/ | ||
|
||
module.exports = { | ||
root: true, | ||
extends: 'airbnb-base', | ||
env: { browser: true, mocha: true }, | ||
parser: '@babel/eslint-parser', | ||
parserOptions: { | ||
allowImportExportEverywhere: true, | ||
sourceType: 'module', | ||
requireConfigFile: false, | ||
}, | ||
extends: '@adobe/helix', | ||
rules: { | ||
'no-param-reassign': [2, { props: false }], | ||
'linebreak-style': ['error', 'unix'], | ||
'import/extensions': ['error', { js: 'always' }], | ||
'object-curly-newline': ['error', { | ||
ObjectExpression: { multiline: true, minProperties: 6 }, | ||
ObjectPattern: { multiline: true, minProperties: 6 }, | ||
ImportDeclaration: { multiline: true, minProperties: 6 }, | ||
ExportDeclaration: { multiline: true, minProperties: 6 }, | ||
}], | ||
'no-await-in-loop': 0, | ||
'class-methods-use-this': 0, | ||
'no-return-assign': ['error', 'except-parens'], | ||
'no-unused-expressions': 0, | ||
'chai-friendly/no-unused-expressions': 2, | ||
'no-underscore-dangle': ['error', { allowAfterThis: 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.', | ||
}, | ||
], | ||
}, | ||
overrides: [ | ||
{ | ||
files: ['test/**/*.js'], | ||
rules: { 'no-console': 'off' }, | ||
}, | ||
], | ||
plugins: [ | ||
'chai-friendly', | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Install, lint, and test | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
jobs: | ||
run-tests: | ||
name: Running tests | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [20.x] | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 2 | ||
|
||
- name: Set up Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Lint the code | ||
run: npm run lint | ||
|
||
- name: Run the tests | ||
run: npm test |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
{ | ||
"reporter": [ | ||
"lcov", | ||
"text" | ||
"text", | ||
"text-summary" | ||
], | ||
"check-coverage": true, | ||
"lines": 10, | ||
"branches": 10, | ||
"statements": 10 | ||
"statements": 10, | ||
"skip-full": true | ||
} |
Oops, something went wrong.