@kontent-ai/eslint-config 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,4 @@
1
+ # Users referenced in this file will automatically be requested as reviewers for PRs that modify the given paths.
2
+ # See https://help.github.com/articles/about-code-owners/
3
+
4
+ * @kontent-ai/developer-relations
@@ -0,0 +1,29 @@
1
+ on:
2
+ release:
3
+ types: [published]
4
+
5
+ name: publish-to-npm
6
+ jobs:
7
+ publish:
8
+ runs-on: ubuntu-latest
9
+
10
+
11
+ steps:
12
+ - uses: actions/checkout@v3
13
+
14
+ - name: Use Node.js
15
+ uses: actions/setup-node@v3
16
+ with:
17
+ node-version-file: '.nvmrc'
18
+ registry-url: 'https://registry.npmjs.org'
19
+ - name: Extract version from tag
20
+ id: get_version
21
+ uses: battila7/get-version-action@v2
22
+ - run: npm --no-git-tag-version version ${{ steps.get_version.outputs.version-without-v }}
23
+ - run: npm publish --access=public
24
+ env:
25
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_API_KEY }}
26
+ - uses: stefanzweifel/git-auto-commit-action@v4
27
+ with:
28
+ commit_message: Adjust release version to ${{ steps.get_version.outputs.version-without-v }}
29
+ branch: ${{ github.event.repository.default_branch }}
package/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ lts/*
@@ -0,0 +1,46 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ 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 age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ ## Our Standards
8
+
9
+ Examples of behavior that contributes to creating a positive environment include:
10
+
11
+ * Using welcoming and inclusive language
12
+ * Being respectful of differing viewpoints and experiences
13
+ * Gracefully accepting constructive criticism
14
+ * Focusing on what is best for the community
15
+ * Showing empathy towards other community members
16
+
17
+ Examples of unacceptable behavior by participants include:
18
+
19
+ * The use of sexualized language or imagery and unwelcome sexual attention or advances
20
+ * Trolling, insulting/derogatory comments, and personal or political attacks
21
+ * Public or private harassment
22
+ * Publishing others' private information, such as a physical or electronic address, without explicit permission
23
+ * Other conduct which could reasonably be considered inappropriate in a professional setting
24
+
25
+ ## Our Responsibilities
26
+
27
+ 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.
28
+
29
+ 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 to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30
+
31
+ ## Scope
32
+
33
+ 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 e-mail 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.
34
+
35
+ ## Enforcement
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at devrel@kontent.ai. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38
+
39
+ 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.
40
+
41
+ ## Attribution
42
+
43
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [https://contributor-covenant.org/version/1/4][version]
44
+
45
+ [homepage]: https://contributor-covenant.org
46
+ [version]: https://contributor-covenant.org/version/1/4/
@@ -0,0 +1,68 @@
1
+ # Ways to contribute
2
+ <img align="right" width="100" height="100" src="https://i.imgur.com/PYTV0jP.png">
3
+
4
+ There are many different ways in which you can contribute. One of the easiest ways is simply to use our software and provide us with your feedback through the right channel. You can also help us improve the open-source projects by submitting pull requests with code and documentation changes.
5
+
6
+ ## Where to get support
7
+ Please note that **level of provided support is always determined by the [LICENSE](LICENSE.md)** of a given open-source project. Also, always make sure you use the **[latest version](../../releases)** of any given OS project. We can't provide any help for older versions. We don't want to make things complicated so we try to take the same approach in all our repositories.
8
+
9
+ ### I found a bug in a Kontent.ai open-source project
10
+ <img align="right" width="100" height="100" src="https://i.imgur.com/TYIQdpv.png">
11
+
12
+ Sorry to hear that. Just log a new [GitHub issue](../../issues) and someone will take a look at it. Remember, the more information you provide, the easier it will be to fix the issue. If you feel like it, you can also fix the bug on your own and submit a new pull request.
13
+
14
+ ### I need help with using the projects and/or coding
15
+ <img align="right" width="100" height="100" src="https://cdn.sstatic.net/Sites/stackoverflow/company/img/logos/so/so-icon.svg">
16
+
17
+ To get help with coding and structuring your projects, use [StackOverflow](https://stackoverflow.com/) and tag your questions with [`kontent-ai`](https://stackoverflow.com/questions/tagged/kontent-ai) tag.
18
+
19
+ Our team members and the community monitor these channels on a regular basis.
20
+
21
+ ### I want to report a security bug
22
+ <img align="right" width="100" height="100" src="https://i.imgur.com/z82nnJB.png">
23
+
24
+ Security issues and bugs should be reported privately, via email, to Kontent.ai Developer Relations Team devrel@kontent.ai. You should receive a response within 24 hours. If for some reason you do not, send us a follow up email to ensure we received your original message.
25
+
26
+
27
+ ### I have an idea for a new feature (or feedback on existing functionality)
28
+ <img align="right" width="100" height="100" src="https://i.imgur.com/rUFkyPy.png">
29
+
30
+ Everybody loves new features! You can submit a new [feature request](../../issues) or you can code it on your own and [send us a pull request](#submitting-pull-requests). In either case, don't forget to mention what's the use case and what's the expected output.
31
+
32
+
33
+ ## Submitting pull requests
34
+ <img align="right" width="100" height="100" src="https://i.imgur.com/aSeiliy.png">
35
+
36
+ Unless you're fixing a typo, it's usually a good idea to discuss the feature before you submit a pull request with code changes, so let's start with submitting a new [GitHub issue](../../issues) and discussing the whether it fits the vision of a given project.
37
+ You might also read these two blogs posts on contributing code: [Open Source Contribution Etiquette](http://tirania.org/blog/archive/2010/Dec-31.html) by Miguel de Icaza and [Don't "Push" Your Pull Requests](https://www.igvita.com/2011/12/19/dont-push-your-pull-requests/) by Ilya Grigorik. Note that all code submissions will be rigorously reviewed and tested by Kontent.ai maintainer teams, and only those that meet an high bar for both quality and design/roadmap appropriateness will be merged into the source.
38
+
39
+
40
+ ### Example - process of contribution
41
+ If not stated otherwise, we use [feature branch workflow](https://www.atlassian.com/git/tutorials/comparing-workflows/feature-branch-workflow).
42
+
43
+ To start with coding, fork the repository you want to contribute to, create a new branch, and start coding. Once the functionality is [done](#Definition-of-Done), you can submit a [pull request](https://help.github.com/articles/about-pull-requests/).
44
+
45
+ ### Definition of Done
46
+ <img align="right" width="100" height="100" src="https://i.imgur.com/g82Ohdv.png">
47
+
48
+ - New/fixed code is covered with tests
49
+ - CI can build the code
50
+ - All tests are pass
51
+ - New version number follows [semantic versioning](https://semver.org/)
52
+ - Coding style (spaces, indentation) is in line with the rest of the code in a given repository
53
+ - Documentation is updated (e.g. code examples in README, Wiki pages, etc.)
54
+ - All `public` members are documented (using XML doc, phpdoc, etc.)
55
+ - Code doesn't contain any secrets (private keys, etc.)
56
+ - Commit messages are clear. Please read these articles: [Writing good commit messages](https://github.com/erlang/otp/wiki/Writing-good-commit-messages), [A Note About Git Commit Messages](https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html), [On commit messages](https://who-t.blogspot.com/2009/12/on-commit-messages.html)
57
+
58
+
59
+ ### Feedback
60
+ <img align="right" width="100" height="100" src="https://i.imgur.com/ZQfNzJJ.png">
61
+
62
+ Your pull request will now go through extensive checks by the subject matter experts on our team. Please be patient. Update your pull request according to feedback until it is approved by one of Kontent.ai maintainers. After that, one of our team members may adjust the branch you merge into based on the expected release schedule.
63
+
64
+
65
+ ## Code of Conduct
66
+ <img align="right" width="100" height="100" src="https://i.imgur.com/cObdKQy.png">
67
+
68
+ The Kontent.ai team is committed to fostering a welcoming community, therefore this project has adopted the [Contributor Covenant Code of Conduct](CODE_OF_CONDUCT.md). If you have any additional questions or comments, you can contact us directly at devrel@kontent.ai.
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Kontent s.r.o.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,39 @@
1
+ [![Contributors][contributors-shield]][contributors-url]
2
+ [![Forks][forks-shield]][forks-url]
3
+ [![Stargazers][stars-shield]][stars-url]
4
+ [![Issues][issues-shield]][issues-url]
5
+ [![MIT License][license-shield]][license-url]
6
+
7
+ [![Discord][discord-shield]][discord-url]
8
+
9
+
10
+ # Kontent.ai eslint configuration
11
+
12
+ This is the eslint configuration that Kontent.ai uses for its TypeScript packages.
13
+
14
+ # Getting Started
15
+
16
+ Install the package and [extend](https://eslint.org/docs/latest/use/configure/configuration-files#extending-configuration-files) from it your eslint configuration.
17
+
18
+ Available configurations are:
19
+ * kontent-ai (default configuration for any TypeScript file)
20
+ * kontent-ai/react (react specific, extends default)
21
+ * kontent-ai/jest (jest specific, extends default)
22
+
23
+ # License
24
+
25
+ Distributed under the MIT License. See [`LICENSE.md`](./LICENSE.md) for more information.
26
+
27
+
28
+ [contributors-shield]: https://img.shields.io/github/contributors/JiriLojda/eslint-config-kontent-ai.svg?style=for-the-badge
29
+ [contributors-url]: https://github.com/JiriLojda/eslint-config-kontent-ai/graphs/contributors
30
+ [forks-shield]: https://img.shields.io/github/forks/JiriLojda/eslint-config-kontent-ai.svg?style=for-the-badge
31
+ [forks-url]: https://github.com/JiriLojda/eslint-config-kontent-ai/network/members
32
+ [stars-shield]: https://img.shields.io/github/stars/JiriLojda/eslint-config-kontent-ai.svg?style=for-the-badge
33
+ [stars-url]: https://github.com/JiriLojda/eslint-config-kontent-ai/stargazers
34
+ [issues-shield]: https://img.shields.io/github/issues/JiriLojda/eslint-config-kontent-ai.svg?style=for-the-badge
35
+ [issues-url]:https://github.com/JiriLojda/eslint-config-kontent-ai/issues
36
+ [license-shield]: https://img.shields.io/github/license/JiriLojda/eslint-config-kontent-ai.svg?style=for-the-badge
37
+ [license-url]:https://github.com/JiriLojda/eslint-config-kontent-ai/blob/master/LICENSE.md
38
+ [discord-shield]: https://img.shields.io/discord/821885171984891914?color=%237289DA&label=Kontent.ai%20Discord&logo=discord&style=for-the-badge
39
+ [discord-url]: https://discord.com/invite/SKCxwPtevJ
package/index.js ADDED
@@ -0,0 +1,71 @@
1
+ module.exports = {
2
+ parser: "@typescript-eslint/parser",
3
+ parserOptions: {
4
+ project: "./tsconfig.json",
5
+ ecmaFeatures: {
6
+ jsx: true,
7
+ },
8
+ sourceType: "module",
9
+ },
10
+ settings: {
11
+ react: {
12
+ version: "detect",
13
+ },
14
+ },
15
+ plugins: [
16
+ "@typescript-eslint",
17
+ "import",
18
+ "simple-import-sort",
19
+ ],
20
+ extends: [
21
+ "eslint:recommended",
22
+ "plugin:@typescript-eslint/eslint-recommended",
23
+ "plugin:import/recommended",
24
+ "plugin:import/typescript",
25
+ ],
26
+ rules: {
27
+ "import/no-deprecated": "error",
28
+ "import/no-empty-named-blocks": "error",
29
+ "import/no-extraneous-dependencies": "error",
30
+ "import/no-mutable-exports": "error",
31
+ "import/no-absolute-path": "error",
32
+ "import/no-useless-path-segments": "error",
33
+ "import/first": "error",
34
+ "import/newline-after-import": "error",
35
+ "import/no-unresolved": "off",
36
+
37
+ "simple-import-sort/imports": "error",
38
+
39
+ "no-dupe-class-members": "off",
40
+ "@typescript-eslint/no-dupe-class-members": "error",
41
+ "@typescript-eslint/consistent-type-assertions": "error",
42
+ "@typescript-eslint/consistent-indexed-object-style": "error",
43
+ "no-unused-expressions": "off",
44
+ "@typescript-eslint/no-unused-expressions": "error",
45
+ "no-unused-vars": "off",
46
+ "@typescript-eslint/no-unused-vars": "error",
47
+ "@typescript-eslint/prefer-literal-enum-member": "error",
48
+ "@typescript-eslint/prefer-enum-initializers": "error",
49
+ "no-loop-func": "off",
50
+ "@typescript-eslint/no-loop-func": "error",
51
+ "@typescript-eslint/no-require-imports": "error",
52
+ "@typescript-eslint/no-confusing-non-null-assertion": "error",
53
+ "no-useless-constructor": "off",
54
+ "@typescript-eslint/no-useless-constructor": "error",
55
+ "@typescript-eslint/no-duplicate-enum-values": "error",
56
+ "@typescript-eslint/no-redundant-type-constituents": "error",
57
+ "@typescript-eslint/no-throw-literal": "error",
58
+ "@typescript-eslint/no-unnecessary-boolean-literal-compare": "error",
59
+ "@typescript-eslint/no-unnecessary-qualifier": "error",
60
+ "@typescript-eslint/no-unnecessary-condition": "error",
61
+ "@typescript-eslint/no-unsafe-declaration-merging": "error",
62
+ "@typescript-eslint/prefer-includes": "error",
63
+ "@typescript-eslint/prefer-return-this-type": "error",
64
+ "@typescript-eslint/prefer-string-starts-ends-with": "error",
65
+ "@typescript-eslint/prefer-for-of": "error",
66
+ "@typescript-eslint/prefer-function-type": "error",
67
+ "@typescript-eslint/prefer-optional-chain": "error",
68
+ "@typescript-eslint/prefer-reduce-type-parameter": "error",
69
+ "@typescript-eslint/prefer-ts-expect-error": "error",
70
+ },
71
+ };
package/jest.js ADDED
@@ -0,0 +1,26 @@
1
+ module.exports = {
2
+ plugins: [
3
+ "jest",
4
+ ],
5
+
6
+ extends: [
7
+ "kontent-ai",
8
+ "plugin:jest/recommended",
9
+ "plugin:jest/style",
10
+ ],
11
+
12
+ rules: {
13
+ "jest/expect-expect": "error",
14
+ "jest/no-duplicate-hooks": "error",
15
+ "jest/no-test-return-statement": "error",
16
+ "jest/prefer-called-with": "error",
17
+ "jest/prefer-comparison-matcher": "error",
18
+ "jest/prefer-equality-matcher": "error",
19
+ "jest/prefer-expect-assertions": ["error", { onlyFunctionsWithAsyncKeyword: true }],
20
+ "jest/prefer-hooks-on-top": "error",
21
+ "jest/prefer-strict-equal": "error",
22
+ "jest/prefer-todo": "error",
23
+ "jest/require-top-level-describe": "error",
24
+
25
+ },
26
+ };
package/package.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "@kontent-ai/eslint-config",
3
+ "version": "0.1.2",
4
+ "description": "Eslint configuration used for packages in Kontent.ai",
5
+ "main": "index.js",
6
+ "private": false,
7
+ "scripts": {},
8
+ "author": "Jiri Lojda",
9
+ "license": "SEE LICENSE IN LICENSE.md",
10
+ "dependencies": {
11
+ "@typescript-eslint/parser": "^5.5.0"
12
+ },
13
+ "peerDependencies": {
14
+ "@typescript-eslint/eslint-plugin": "^5.0.0",
15
+ "eslint": "^8.0.0",
16
+ "eslint-plugin-jest": "^25.0.0",
17
+ "eslint-plugin-import": "^2.27.5",
18
+ "eslint-plugin-react": "^7.0.0",
19
+ "eslint-plugin-react-hooks": "^4.0.0",
20
+ "eslint-plugin-simple-import-sort": "^9.0.0"
21
+ }
22
+ }
package/react.js ADDED
@@ -0,0 +1,71 @@
1
+ module.exports = {
2
+ plugins: [
3
+ "react",
4
+ "react-hooks",
5
+ ],
6
+
7
+ extends: [
8
+ "kontent-ai",
9
+ ],
10
+
11
+ rules: {
12
+ "react/hook-use-state": "error",
13
+ "react/jsx-boolean-value": "error",
14
+ "react/jsx-closing-bracket-location": "error",
15
+ "react/jsx-closing-tag-location": "error",
16
+ "react/jsx-curly-brace-presence": "error",
17
+ "react/jsx-curly-spacing": [
18
+ "error", {
19
+ when: "never",
20
+ attributes: true,
21
+ children: true,
22
+ },
23
+ ],
24
+ "react/jsx-equals-spacing": "error",
25
+ "react/jsx-filename-extension": ["error", { extensions: [".tsx"] }],
26
+ "react/jsx-first-prop-new-line": ["error", "multiline"],
27
+ "react/jsx-fragments": "error",
28
+ "react/jsx-indent-props": ["error", 2],
29
+ "react/jsx-max-props-per-line": "error",
30
+ "react/jsx-no-bind": [
31
+ "error",
32
+ {
33
+ ignoreRefs: true,
34
+ allowArrowFunctions: true,
35
+ },
36
+ ],
37
+ "react/jsx-no-constructed-context-values": "error",
38
+ "react/jsx-no-script-url": "error",
39
+ "react/jsx-pascal-case": "error",
40
+ "react/jsx-props-no-multi-spaces": "error",
41
+ "react/jsx-tag-spacing": "error",
42
+ "react/jsx-wrap-multilines": [
43
+ "error",
44
+ {
45
+ declaration: "parens-new-line",
46
+ assignment: "parens-new-line",
47
+ return: "parens-new-line",
48
+ arrow: "parens-new-line",
49
+ condition: "parens-new-line",
50
+ logical: "parens-new-line",
51
+ prop: "parens-new-line",
52
+ },
53
+ ],
54
+ "react/no-access-state-in-setstate": "error",
55
+ "react/no-danger": "error",
56
+ "react/no-redundant-should-component-update": "error",
57
+ "react/no-unsafe": "error",
58
+ "react/no-unused-state": "error",
59
+ "react/no-unknown-property": ["error", { ignore: ["css"] }],
60
+ "react/no-typos": "error",
61
+ "react/no-this-in-sfc": "error",
62
+ "react/self-closing-comp": "error",
63
+ "react/void-dom-elements-no-children": "error",
64
+ "react/style-prop-object": "error",
65
+ "react/jsx-no-leaked-render": "off",
66
+ "react/prefer-stateless-function": "error",
67
+
68
+ "react-hooks/rules-of-hooks": "error",
69
+ "react-hooks/exhaustive-deps": "error",
70
+ },
71
+ }