@travetto/eslint 3.0.2 → 3.0.3

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.
package/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  <!-- This file was generated by @travetto/doc and should not be modified directly -->
2
- <!-- Please modify https://github.com/travetto/travetto/tree/main/module/eslint/DOC.ts and execute "npx trv doc" to rebuild -->
2
+ <!-- Please modify https://github.com/travetto/travetto/tree/main/module/eslint/DOC.tsx and execute "npx trv doc" to rebuild -->
3
3
  # ES Linting Rules
4
+
4
5
  ## ES Linting Rules
5
6
 
6
7
  **Install: @travetto/eslint**
@@ -12,12 +13,12 @@ npm install @travetto/eslint
12
13
  yarn add @travetto/eslint
13
14
  ```
14
15
 
15
- [ESLint](https://eslint.org/) is the standard for linting [Typescript](https://typescriptlang.org) and [Javascript](https://developer.mozilla.org/en-US/docs/Web/JavaScript) code. This module provides some standard linting patterns and the ability to create custom rules. Due to the fact that the framework supports both [CommonJS](https://nodejs.org/api/modules.html) and [Ecmascript Module](https://nodejs.org/api/esm.html) formats, a novel solution was required to allow [ESLint](https://eslint.org/) to load [Ecmascript Module](https://nodejs.org/api/esm.html) files.
16
+ [ESLint](https://eslint.org/) is the standard for linting [Typescript](https://typescriptlang.org) and [Javascript](https://developer.mozilla.org/en-US/docs/Web/JavaScript) code. This module provides some standard linting patterns and the ability to create custom rules. Due to the fact that the framework supports both [CommonJS](https://nodejs.org/api/modules.html) and [Ecmascript Module](https://nodejs.org/api/esm.html) formats, a novel solution was required to allow [ESLint](https://eslint.org/) to load [Ecmascript Module](https://nodejs.org/api/esm.html) files.
16
17
 
17
18
  **Note**: The [ESLint](https://eslint.org/) has introduced [a new configuration format](https://eslint.org/blog/2022/08/new-config-system-part-3/) which allows for [Ecmascript Module](https://nodejs.org/api/esm.html) files.
18
19
 
19
20
  ## CLI - Register
20
- In a new project, the first thing that will need to be done, post installation, is to create the eslint configuration file.
21
+ In a new project, the first thing that will need to be done, post installation, is to create the eslint configuration file.
21
22
 
22
23
  **Terminal: Registering the Configuration**
23
24
  ```bash
@@ -26,7 +27,7 @@ $ trv lint:register
26
27
  Wrote eslint config to <workspace-root>/eslint.config.js
27
28
  ```
28
29
 
29
- This is the file the linter will use, and any other tooling (e.g. IDEs).
30
+ This is the file the linter will use, and any other tooling (e.g. IDEs).
30
31
 
31
32
  **Code: Sample configuration**
32
33
  ```javascript
@@ -42,7 +43,6 @@ module.exports = config;
42
43
  The output is tied to whether or not you are using the [CommonJS](https://nodejs.org/api/modules.html) or [Ecmascript Module](https://nodejs.org/api/esm.html) format.
43
44
 
44
45
  ## CLI - Lint
45
-
46
46
  Once installed, using the linter is as simple as invoking it via the cli:
47
47
 
48
48
  **Terminal: Running the Linter**
@@ -53,9 +53,9 @@ npx trv lint
53
53
  Or pointing your IDE to reference the registered configuration file.
54
54
 
55
55
  ## Custom Rules
56
- It can be seen in the sample configuration, that the configuration is looking for files with the pattern of `support/eslint/.*`
56
+ It can be seen in the sample configuration, that the configuration is looking for files with the pattern of `support/eslint/.*`
57
57
 
58
- These files will follow a given pattern of:
58
+ These files will follow a given pattern of:
59
59
 
60
60
  **Code: Custom Rule Shape**
61
61
  ```typescript
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/eslint",
3
- "version": "3.0.2",
3
+ "version": "3.0.3",
4
4
  "description": "ES Linting Rules",
5
5
  "keywords": [
6
6
  "eslint",
@@ -23,7 +23,7 @@
23
23
  "directory": "module/eslint"
24
24
  },
25
25
  "dependencies": {
26
- "@travetto/manifest": "^3.0.2",
26
+ "@travetto/manifest": "^3.0.3",
27
27
  "@types/eslint": "^8.21.1",
28
28
  "@typescript-eslint/eslint-plugin": "^5.52.0",
29
29
  "@typescript-eslint/parser": "^5.52.0",
@@ -31,7 +31,7 @@
31
31
  "eslint-plugin-unused-imports": "^2.0.0"
32
32
  },
33
33
  "peerDependencies": {
34
- "@travetto/cli": "^3.0.2"
34
+ "@travetto/cli": "^3.0.3"
35
35
  },
36
36
  "peerDependenciesMeta": {
37
37
  "@travetto/cli": {
@@ -27,7 +27,7 @@ export function buildConfig(pluginMaps: Record<string, TrvEslintPlugin>[]): read
27
27
  { ignores: IGNORES, },
28
28
  {
29
29
  ...RULE_COMMON,
30
- files: ['**/*.ts', '**/*.js'],
30
+ files: ['**/*.ts', '**/*.tsx', '**/*.js'],
31
31
  plugins: {
32
32
  '@typescript-eslint': {
33
33
  rules: tsEslintPlugin.rules,
@@ -44,7 +44,7 @@ export function buildConfig(pluginMaps: Record<string, TrvEslintPlugin>[]): read
44
44
  },
45
45
  {
46
46
  ...RULE_COMMON,
47
- files: ['**/*.ts'],
47
+ files: ['**/*.ts', '**/*.tsx'],
48
48
  rules: {
49
49
  '@typescript-eslint/explicit-function-return-type': 'warn',
50
50
  'no-undef': 0,
@@ -52,7 +52,7 @@ export function buildConfig(pluginMaps: Record<string, TrvEslintPlugin>[]): read
52
52
  },
53
53
  {
54
54
  ...RULE_COMMON,
55
- files: ['**/DOC.ts', '**/doc/**/*.ts'],
55
+ files: ['**/DOC.ts', '**/DOC.tsx', '**/doc/**/*.ts', '**/doc/**/*.tsx'],
56
56
  rules: {
57
57
  'max-len': 0,
58
58
  '@typescript-eslint/quotes': 'warn',
@@ -63,14 +63,18 @@ export function buildConfig(pluginMaps: Record<string, TrvEslintPlugin>[]): read
63
63
  },
64
64
  {
65
65
  ...RULE_COMMON,
66
- files: ['module/compiler/**/*.ts', 'module/transformer/**/*.ts', '**/support/transform*.ts', '**/support/transformer.*.ts'],
66
+ files: [
67
+ 'module/compiler/**/*.ts', 'module/transformer/**/*.ts',
68
+ '**/support/transform*.ts', '**/support/transformer.*.ts',
69
+ '**/support/transform*.tsx', '**/support/transformer.*.tsx'
70
+ ],
67
71
  rules: {
68
72
  'no-restricted-imports': 0
69
73
  }
70
74
  },
71
75
  {
72
76
  ...RULE_COMMON,
73
- files: ['**/test/**/*.ts', '**/support/test/**/*.ts'],
77
+ files: ['**/test/**/*.ts', '**/test/**/*.tsx', '**/support/test/**/*.ts', '**/support/test/**/*.tsx'],
74
78
  rules: {
75
79
  '@typescript-eslint/consistent-type-assertions': 0,
76
80
  '@typescript-eslint/explicit-function-return-type': 0