-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build(root): Initial project scaffolding #2
Changes from 21 commits
05d6752
f623fb3
163a05b
f7baef3
8cde185
5baf5fb
c412301
85ac589
343ca82
08f0a43
1d7b7ea
8a0ad5a
df24f10
5a080b8
9ffae41
03ed0de
d3db063
4a183fa
1bc9a35
303b9c2
f866783
3fdfb3b
61a5d12
f390e1a
9ca1584
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 4 | ||
trim_trailing_whitespace = true | ||
|
||
[*.{json,yml}] | ||
indent_size = 2 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
module.exports = { | ||
root: true, | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
tsconfigRootDir: __dirname, | ||
project: ['./tsconfig.json'], | ||
}, | ||
plugins: [ | ||
'@typescript-eslint', | ||
'jest', | ||
'prettier', | ||
'notice', // checks for and fixes copyright header in each file | ||
], | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/eslint-recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:@typescript-eslint/recommended-requiring-type-checking', | ||
'plugin:jest/recommended', | ||
'plugin:jest/style', | ||
'plugin:prettier/recommended', | ||
'prettier/@typescript-eslint', | ||
], | ||
rules: { | ||
'notice/notice': [ | ||
'error', | ||
{ | ||
templateFile: 'license-header.txt', | ||
}, | ||
], | ||
}, | ||
env: { | ||
browser: true, | ||
node: true, | ||
}, | ||
ignorePatterns: ['node_modules', 'dist', 'coverage'], | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Mark generated files so that github can better display diffs in PRs | ||
# https://help.github.com/articles/customizing-how-changed-files-appear-on-github/ | ||
# https://github.com/github/linguist#using-gitattributes | ||
# https://www.git-scm.com/docs/gitignore#_pattern_format | ||
# | ||
# Mark generated files | ||
yarn.lock linguist-generated=true | ||
# generated JS files | ||
dist/* linguist-generated=true |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
*.log | ||
.DS_Store | ||
.vscode/ | ||
.idea/ | ||
.project/ | ||
packages/**/dist/ | ||
node_modules/ | ||
coverage/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
@types:registry=https://registry.npmjs.org/ | ||
registry=https://registry.npmjs.org/ | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
tabWidth: 4, | ||
printWidth: 120, | ||
singleQuote: true, | ||
trailingComma: 'es5' | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
# Salesforce Open Source Community Code of Conduct | ||
|
||
## About the Code of Conduct | ||
|
||
Equality is a core value at Salesforce. We believe a diverse and inclusive | ||
community fosters innovation and creativity, and are committed to building a | ||
culture where everyone feels included. | ||
|
||
Salesforce open-source projects are committed to providing a friendly, safe, and | ||
welcoming environment for all, regardless of gender identity and expression, | ||
sexual orientation, disability, physical appearance, body size, ethnicity, nationality, | ||
race, age, religion, level of experience, education, socioeconomic status, or | ||
other similar personal characteristics. | ||
|
||
The goal of this code of conduct is to specify a baseline standard of behavior so | ||
that people with different social values and communication styles can work | ||
together effectively, productively, and respectfully in our open source community. | ||
It also establishes a mechanism for reporting issues and resolving conflicts. | ||
|
||
All questions and reports of abusive, harassing, or otherwise unacceptable behavior | ||
in a Salesforce open-source project may be reported by contacting the Salesforce | ||
Open Source Conduct Committee at [email protected]. | ||
|
||
## Our Pledge | ||
|
||
In the interest of fostering an open and welcoming environment, we as | ||
contributors and maintainers pledge to making participation in our project and | ||
our community a harassment-free experience for everyone, regardless of gender | ||
identity and expression, sexual orientation, disability, physical appearance, | ||
body size, ethnicity, nationality, race, age, religion, level of experience, education, | ||
socioeconomic status, or other similar personal characteristics. | ||
|
||
## Our Standards | ||
|
||
Examples of behavior that contributes to creating a positive environment | ||
include: | ||
|
||
* Using welcoming and inclusive language | ||
* Being respectful of differing viewpoints and experiences | ||
* Gracefully accepting constructive criticism | ||
* Focusing on what is best for the community | ||
* Showing empathy toward other community members | ||
|
||
Examples of unacceptable behavior by participants include: | ||
|
||
* The use of sexualized language or imagery and unwelcome sexual attention or | ||
advances | ||
* Personal attacks, insulting/derogatory comments, or trolling | ||
* Public or private harassment | ||
* Publishing, or threatening to publish, others' private information—such as | ||
a physical or electronic address—without explicit permission | ||
* Other conduct which could reasonably be considered inappropriate in a | ||
professional setting | ||
* Advocating for or encouraging any of the above behaviors | ||
|
||
## Our Responsibilities | ||
|
||
Project maintainers are responsible for clarifying the standards of acceptable | ||
behavior and are expected to take appropriate and fair corrective action in | ||
response to any instances of unacceptable behavior. | ||
|
||
Project maintainers have the right and responsibility to remove, edit, or | ||
reject comments, commits, code, wiki edits, issues, and other contributions | ||
that are not aligned with this Code of Conduct, or to ban temporarily or | ||
permanently any contributor for other behaviors that they deem inappropriate, | ||
threatening, offensive, or harmful. | ||
|
||
## Scope | ||
|
||
This Code of Conduct applies both within project spaces and in public spaces | ||
when an individual is representing the project or its community. Examples of | ||
representing a project or community include using an official project email | ||
address, posting via an official social media account, or acting as an appointed | ||
representative at an online or offline event. Representation of a project may be | ||
further defined and clarified by project maintainers. | ||
|
||
## Enforcement | ||
|
||
Instances of abusive, harassing, or otherwise unacceptable behavior may be | ||
reported by contacting the Salesforce Open Source Conduct Committee | ||
at [email protected]. All complaints will be reviewed and investigated | ||
and will result in a response that is deemed necessary and appropriate to the | ||
circumstances. The committee is obligated to maintain confidentiality with | ||
regard to the reporter of an incident. Further details of specific enforcement | ||
policies may be posted separately. | ||
|
||
Project maintainers who do not follow or enforce the Code of Conduct in good | ||
faith may face temporary or permanent repercussions as determined by other | ||
members of the project's leadership and the Salesforce Open Source Conduct | ||
Committee. | ||
|
||
## Attribution | ||
|
||
This Code of Conduct is adapted from the [Contributor Covenant][contributor-covenant-home], | ||
version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html. | ||
It includes adaptions and additions from [Go Community Code of Conduct][golang-coc], | ||
[CNCF Code of Conduct][cncf-coc], and [Microsoft Open Source Code of Conduct][microsoft-coc]. | ||
|
||
This Code of Conduct is licensed under the [Creative Commons Attribution 3.0 License][cc-by-3-us]. | ||
|
||
[contributor-covenant-home]: https://www.contributor-covenant.org (https://www.contributor-covenant.org/) | ||
[golang-coc]: https://golang.org/conduct | ||
[cncf-coc]: https://github.com/cncf/foundation/blob/master/code-of-conduct.md | ||
[microsoft-coc]: https://opensource.microsoft.com/codeofconduct/ | ||
[cc-by-3-us]: https://creativecommons.org/licenses/by/3.0/us/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Copyright (c) 2020, Salesforce.com, Inc. | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
|
||
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | ||
|
||
* Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Salesforce Accessibility Automation Libraries | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: this file name is usually all caps ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
|
||
Salesforce Accessibility Automated Testing Libraries and Tools (@sa11y packages). | ||
|
||
- [Salesforce Accessibility Automation Libraries](#salesforce-accessibility-automation-libraries) | ||
- [Packages](#packages) | ||
- [Preset Accessibility rules](#preset-accessibility-rules) | ||
- [assertAccessible API](#assertaccessible-api) | ||
- [Jest integration](#jest-integration) | ||
|
||
## Packages | ||
This repo contains the following packages | ||
|
||
### Preset Accessibility rules | ||
* provides Recommended, Extended accessibility preset rule sets as axe configuration | ||
|
||
### assertAccessible API | ||
* checks current DOM for accessibility issues and throws an error when a11y issues are found | ||
|
||
### a11y results formatter | ||
* format raw a11y issues JSON output from axe into an easy to consume format by consolidating and cross-referencing | ||
|
||
### Jest integration | ||
* integrates the [assertAccessible API](#assertaccessible-api) with the [Jest assertion API](https://jestjs.io/docs/en/using-matchers) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* | ||
* Copyright (c) 2020, salesforce.com, inc. | ||
* All rights reserved. | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause | ||
*/ | ||
module.exports = { | ||
extends: ['@commitlint/config-conventional'], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I personally find that linting commits like this can be confusing for people who don't use it frequently. I've also seen people be confused by what exactly the issue is with their commit title/message. Nothing wrong with keeping this if you like it, but if you do I would make sure when there's an error it's clear what's wrong. LWC has a section in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good to know thanks. Added contribution guidelines to this project as well based on lwc. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Btw I am also going to try limiting to squashing commits when merging to master - to have a saner commit history (since I tend to create a lot of granular commits). So this should result in one commit per PR in master in which case the commit linting is rendered moot I guess. If this could be problematic or not ideal, please let me know. |
||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* | ||
* Copyright (c) 2020, salesforce.com, inc. | ||
* All rights reserved. | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause | ||
*/ | ||
module.exports = { | ||
preset: 'ts-jest', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With Jest 24 there's much better support for Typescript: https://jestjs.io/blog/2019/01/25/jest-24-refreshing-polished-typescript-friendly#typescript-support. The maintainer of ts-jest has basically said to just use native Jest: kulshekhar/ts-jest#961 (comment) I wouldn't say this is a must-have, but worth considering for the future since other projects have reported a speed improvement moving away from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I saw references to using babel for compiling ts. But then I also saw https://kulshekhar.github.io/ts-jest/user/babel7-or-ts which lists some features not available in babel yet. Not sure if that info is current. And since this project doesn't use babel yet - I didn't want to bring it in as a dependency yet. Not sure if we will need babel for any other purpose? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know if you'll need Babel for other stuff. FWIW Babel is a dependency of Jest so you technically are already pulling it in to the project as a transitive dependency. I think using babel + Jest is the best thing to do but I don't think it will be particularly hard to make that switch in the future so if you want to stick with this for now and re-evaluate later when you have more tests that's fine. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks Trevor. Didn't know that babel is already a Jest dependency. Tried replacing ts-jest with |
||
testEnvironment: 'node', | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"packages": [ | ||
"packages/*" | ||
], | ||
"version": "independent", | ||
"npmClient": "yarn", | ||
"useWorkspaces": true | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/* | ||
* Copyright (c) <%= YEAR %>, salesforce.com, inc. | ||
* All rights reserved. | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause | ||
*/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{ | ||
"name": "root", | ||
"private": true, | ||
"description": "Salesforce Accessibility Automated Testing Libraries and Tools (@sa11y packages)", | ||
"repository": { | ||
"url": "git://github.com/salesforce/sa11y.git" | ||
}, | ||
"homepage": "https://help.salesforce.com/articleView?id=accessibility_overview.htm&type=5", | ||
"workspaces": [ | ||
"packages/*" | ||
], | ||
"scripts": { | ||
"commit": "! git diff --cached --exit-code && git-cz", | ||
"lint": "yarn eslint --fix . --ext .js,.ts", | ||
"test": "jest" | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "lint-staged", | ||
"commit-msg": "commitlint -e $GIT_PARAMS" | ||
} | ||
}, | ||
"lint-staged": { | ||
"**/*.{js,ts}": "eslint --fix", | ||
"**/*.{js,ts,json,md}": "prettier --write" | ||
}, | ||
"devDependencies": { | ||
"@commitlint/cli": "^8.3.5", | ||
"@commitlint/config-conventional": "^8.3.4", | ||
"@types/jest": "^25.1.4", | ||
"@typescript-eslint/eslint-plugin": "^2.23.0", | ||
"@typescript-eslint/parser": "^2.23.0", | ||
"commitizen": "^4.0.3", | ||
"eslint": "^6.8.0", | ||
"eslint-config-prettier": "^6.10.0", | ||
"eslint-plugin-jest": "^23.8.2", | ||
"eslint-plugin-license-header": "^0.2.0", | ||
"eslint-plugin-notice": "^0.8.9", | ||
"eslint-plugin-prettier": "^3.1.2", | ||
"husky": "^4.2.3", | ||
"jest": "^25.1.0", | ||
"lerna": "^3.20.2", | ||
"lint-staged": "^10.0.8", | ||
"prettier": "1.19.1", | ||
"ts-jest": "^25.2.1", | ||
"typescript": "^3.8.3" | ||
}, | ||
"config": { | ||
"commitizen": { | ||
"path": "./node_modules/cz-conventional-changelog" | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | ||
|
||
name: Node.js CI | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
pull_request: | ||
branches: [master] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: '10.x' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Active LTS support for Node 10 ends the end of April. Version 12 is active LTS until the end of October, it may be worth switching to 12 now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great, thanks for the info! Updated. |
||
- run: yarn install | ||
- run: yarn test | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a linting job here before unit tests?
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes! Had it in the #3 PR - ported it over. Made a |
||
env: | ||
CI: true |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# `@sa11y/rules` | ||
|
||
> TODO: description | ||
|
||
## Usage | ||
|
||
``` | ||
const rules = require('@sa11y/rules'); | ||
|
||
// TODO: DEMONSTRATE API | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* | ||
* Copyright (c) 2020, salesforce.com, inc. | ||
* All rights reserved. | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause | ||
*/ | ||
'use strict'; | ||
|
||
const rules = require('..'); | ||
|
||
describe('@sa11y/rules', () => { | ||
it('needs tests'); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* | ||
* Copyright (c) 2020, salesforce.com, inc. | ||
* All rights reserved. | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause | ||
*/ | ||
'use strict'; | ||
|
||
module.exports = rules; | ||
|
||
function rules() { | ||
// TODO | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need to set these? They should be the defaults.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since I have the internal nexus registry configured in the global
.npmrc
, it was resulting in refs to the internal nexus in theyarn.lock
file. Hence had to override it to make sure there are no refs to internal registry - which could affect the CI among others. I guess most projects override the publish config inpackage.json
to the public npm?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree the references should point to the pubic registry rather than internal Nexus for this project. From an open source point of view I don't think there should be any references to the public registry though. I personally comment out the line pointing to Nexus in my root npmrc and only uncomment it when I need to access internal stuff.
Since it's probably a ways away from being truly open source it's probably fine to leave for now, but I think it should be removed by the time it's exposed externally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we can also switch npm registries using profiles https://docs.npmjs.com/configuring-your-registry-settings-as-an-npm-enterprise-user#create-a-profile-for-the-public-npm-registry
But then this adds a manual step to the process which could be easily forgotten.
Agree that we can revisit this later again when we are ready to make this public.