Skip to content

Commit

Permalink
Merge pull request #2 from team23/dev/rework-linting-setup
Browse files Browse the repository at this point in the history
Rework linting setup for JS, TS, Angular and Vue
  • Loading branch information
erikherberg authored Sep 9, 2024
2 parents fdb9676 + 0b3cd34 commit 06acb0a
Show file tree
Hide file tree
Showing 70 changed files with 21,387 additions and 4,833 deletions.
501 changes: 501 additions & 0 deletions .editorconfig

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
### Summary of Changes

- Provide a brief overview of the changes made in this MR.
- Include any relevant context or background information to help the reviewer understand the purpose and scope of the changes.

### Open Todos

- [ ] List any remaining tasks that need to be completed before this MR can be merged.
- [ ] If there are no open tasks, please remove this section.

### Additional Notes

- Add any extra information that might be useful for the reviewer.
- This could include potential impact, performance considerations, or references to related documentation or issues.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,7 @@ testem.log
.DS_Store
Thumbs.db

.nx/cache
.nx

# Compiler artifacts
/libs/*/*.tsbuildinfo
20 changes: 20 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-json
- id: check-added-large-files
- id: check-yaml
- id: check-merge-conflict
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: v9.16.0
hooks:
- id: commitlint
stages: [commit-msg]
additional_dependencies:
- "@team23/commitlint-config@1.0.0"
default_stages:
- commit
default_install_hook_types:
- pre-commit
- commit-msg
28 changes: 28 additions & 0 deletions .verdaccio/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# path to a directory with all packages
storage: ../tmp/local-registry/storage

# a list of other known repositories we can talk to
uplinks:
npmjs:
url: https://registry.npmjs.org/
maxage: 60m

packages:
'**':
# give all users (including non-authenticated users) full access
# because it is a local registry
access: $all
publish: $all
unpublish: $all

# if package is not available locally, proxy requests to npm registry
proxy: npmjs

# log settings
logs:
type: stdout
format: pretty
level: warn

publish:
allow_offline: true # set offline to true to allow publish offline
5 changes: 3 additions & 2 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"recommendations": [

"nrwl.angular-console"
"nrwl.angular-console",
"esbenp.prettier-vscode",
"firsttris.vscode-jest-runner"
]
}
32 changes: 32 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Contributing

Please be sure to read the contribution guidelines before making or requesting a change.

## Naming branches

As a convention all dev branches should be named by the following pattern: `dev/short_ticket_name`

### Commits

Please follow the [TEAM23 SE commit standard](https://confluence.team23.de/display/AP/Commit+Standard), i.e.

```bash
<type>[(<optional scope)>]: [optional ticket ID] <description>

[optional body]

[optional footer(s)]
```

#### Available commit scopes

Please use **one** of these scopes when fitting:

- No scope is used: changes affect the entire repository
- **java-script**: changes affect [java-script](libs/java-script)
- **type-script**: changes affect [type-script](libs/type-script)
- **vue**: changes affect [vue](libs/vue)

## Pull request

Please use the [PULL_REQUEST_TEMPLATE.md](.github/PULL_REQUEST_TEMPLATE.md)
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2024 TEAM23

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
78 changes: 20 additions & 58 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,76 +1,38 @@
# StyleGuide
# Style Guide

<a alt="Nx logo" href="https://nx.dev" target="_blank" rel="noreferrer"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-logo.png" width="45"></a>
## Overview

**This workspace has been generated by [Nx, Smart Monorepos · Fast CI.](https://nx.dev)**
This repository contains the TEAM23 configuration for linting and styling rules.
It includes configurations for ESLint (JavaScript, TypeScript and Vue.js).
These configurations help maintain code quality and consistency across TEAM23's projects.

## Integrate with editors
## Debug eslint configurations

Enhance your Nx experience by installing [Nx Console](https://nx.dev/nx-console) for your favorite editor. Nx Console
provides an interactive UI to view your projects, run tasks, generate code, and more! Available for VSCode, IntelliJ and
comes with a LSP for Vim users.
### config-inspector

## Nx plugins and code generators

Add Nx plugins to leverage their code generators and automated, inferred tasks.
Use the official config-inspector to inspect and understand the flat config.

```shell
bun build ./src/index.ts --target=node --outfile eslint.config.js
```
# Add plugin
npx nx add @nx/react
# Use code generator
npx nx generate @nx/react:app demo
# Run development server
npx nx serve demo

# View project details
npx nx show project demo --web
```shell
npx @eslint/config-inspector
```

Run `npx nx list` to get a list of available plugins and whether they have generators. Then run `npx nx list <plugin-name>` to see what generators are available.

Learn more about [code generators](https://nx.dev/features/generate-code) and [inferred tasks](https://nx.dev/concepts/inferred-tasks) in the docs.

## Running tasks
You may need to install bun:

To execute tasks with Nx use the following syntax:

```
npx nx <target> <project> <...options>
```shell
npm install --global bun
```

You can also run multiple targets:
### Use --print-config

```
npx nx run-many -t <target1> <target2>
```
You can additionally use the `--print-config` CLI option to view the final configuration that will be used for a file. Note that only
configuration options applied to this file will be outputted.

..or add `-p` to filter specific projects
You may want to use a bundler like bun to compile and bundle all files:

```
npx nx run-many -t <target1> <target2> -p <proj1> <proj2>
bun --bun eslint -c index.ts --print-config test.js > out.json
```

Targets can be defined in the `package.json` or `projects.json`. Learn more [in the docs](https://nx.dev/features/run-tasks).

## Set up CI!

Nx comes with local caching already built-in (check your `nx.json`). On CI you might want to go a step further.

- [Set up remote caching](https://nx.dev/features/share-your-cache)
- [Set up task distribution across multiple machines](https://nx.dev/nx-cloud/features/distribute-task-execution)
- [Learn more how to setup CI](https://nx.dev/recipes/ci)

## Explore the project graph

Run `npx nx graph` to show the graph of the workspace.
It will show tasks that you can run with Nx.

- [Learn more about Exploring the Project Graph](https://nx.dev/core-features/explore-graph)

## Connect with us!

- [Join the community](https://nx.dev/community)
- [Subscribe to the Nx Youtube Channel](https://www.youtube.com/@nxdevtools)
- [Follow us on Twitter](https://twitter.com/nxdevtools)
3 changes: 3 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['@team23/commitlint-config'],
};
22 changes: 22 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { createTSEslintConfig } from "@team23/eslint-config-team23-ts";

export default [
...createTSEslintConfig(),
{
files: ['**/eslint.config.js', '**/src/**/*.ts'],
rules: {
'@typescript-eslint/naming-convention': 'off',
},
},
{
files: ['**/eslint.config.js'],
rules: {
'import-x/default': 'off',
'import-x/namespace': 'off',
'import-x/no-deprecated': 'off',
'import-x/no-named-as-default': 'off',
'import-x/no-named-as-default-member': 'off',
'no-magic-numbers': 'off',
},
},
];
110 changes: 110 additions & 0 deletions libs/angular/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# Changelog

All notable changes to this project will be documented in this file.

## v18.0.0

### Breaking Changes

#### Updated ESLint version to 9.0.0

- The minimum required version of ESLint has been updated from `^8.0.0` to `^9.9.0`. This is a significant update
that does require making changes to accommodate the new linting rules and features provided by ESLint 9.x.
- A key feature introduced in ESLint 9.x is the required use
[of the new Flat Config format](https://eslint.org/docs/latest/use/configure/configuration-files).
Flat Config is a modern and streamlined approach to configuring ESLint, replacing the traditional `.eslintrc`
configuration files.
- If you do want to know how to use this library with Flat Config, checkout its [README.md](README.md).

#### Changes to rules

- The upgrade to ESLint 9.x and associated plugins brought about changes in several existing rules.
Some rules have been deprecated, modified, or replaced with more up-to-date equivalents.
These changes reflect the latest developments in TypeScript standards and best practices, and may require you to
adjust your code to meet the new requirements.

### Changes

- Updated the repository URL and structure to reflect the new project structure within a monorepo
at `https://github.com/team23/style-guide.git` under the `libs/angular` directory.
- Updated `homepage` URL to `https://github.com/team23/style-guide/libs/angular`.
- Enhanced the keywords in `package.json` to improve discoverability. New keywords
include `"eslint-config"` and `"angular"`.
- The license and documentation files have been explicitly listed in the `files` field
to ensure they are included in the published package.
- The package now uses an `exports` field to define the entry points for different
module formats (`import`, `require`, `types`). This change might affect how the package is consumed in different
environments.
- `tsc-multi` was introduced to support usage in ESM and CommonJS projects.
- The `files` field in `package.json` has been defined to include only the necessary files in the
npm package, improving the package's footprint.
- `typescript-eslint` has been introduced as a dependency for type-safe rule configuration.

## v17.0.1
- Update compatibilities to latest versions

## v17.0.0
### Breaking Change
- The major version primarily communicates the alignment with Angular's major version. Only Angular 17 is supported.
- Add `@angular-eslint/template/attributes-order` rule for ordering template attributes
- Add `@angular-eslint/template/@angular-eslint/template/prefer-self-closing-tags` rule for forcing self closing tags

## v16.1.1
- Disable `@typescript-eslint/promise-function-async` for angular `.routes.ts` files

## v16.1.0
- Switch the accessibility rules in the `@angular-eslint/eslint-plugin-template` dependency to `error`

## v16.0.1
- Update `@typescript-eslint` as peerDependency to version `^6.0.0`

## v16.0.0
### Breaking Change
- Update `@angular` as peerDependency to version `^16.0.0`
- Update `@angular-eslint` as peerDependency to version `^16.0.0`

## v15.0.1
- change path of typescript parserOptions

## v15.0.0
- Update all dependencies
- Adapt version to major angular version

## v2.0.2
- Add support for @angular@14

## v2.0.1
- Use **tsconfig.base.json** instead of **tsconfig.json**

## v2.0.0
- Clean new version

## v1.0.9
- Add support for eslint@8

## v1.0.8
- Add support for @angular@13

## v1.0.7
- Add eslint rules for *.ts files

## v1.0.6
- Add **eslint-plugin-html** to dependency to be able to lint html files

## v1.0.5
- Remove **eslint-config-team23-standard** dependency for independent usage

## v1.0.4
- Update **eslint-config-team23-standard** to version 1.0.4

## v1.0.3
- Update version number to be aligned with eslint-config-team23-standard

## v1.0.2
- Update version number to be aligned with eslint-config-team23-standard

## v1.0.1
- Update version number to be aligned with eslint-config-team23-standard

## v1.0.0
- Initial release with eslint rules for js inspired by current projects
21 changes: 21 additions & 0 deletions libs/angular/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2024 TEAM23

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading

0 comments on commit 06acb0a

Please sign in to comment.