@enke.dev/lint 0.10.7 → 0.11.1

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
@@ -58,6 +58,16 @@ The VSCode Eslint plugin can be configured to pick up packages correctly by upda
58
58
  }
59
59
  ```
60
60
 
61
+ ## Prepare Prettier config
62
+
63
+ A [shared prettier configuration](https://prettier.io/docs/sharing-configurations) can be used by creating a `prettier.config.js` or `prettier.config.ts` file in the root of your project with the following content:
64
+
65
+ ```js
66
+ import config from '@enke.dev/lint/prettier.config.js';
67
+
68
+ export default config;
69
+ ```
70
+
61
71
  ## Prepare Stylelint config (experimental)
62
72
 
63
73
  Uses some common presets and can be used in CSS, SASS and SCSS files.\
package/eslint.config.js CHANGED
@@ -1,7 +1,5 @@
1
- /// <reference types="./eslint-plugins.d.ts" />
2
- import { readFile } from 'node:fs/promises';
1
+ import { existsSync, readFileSync } from 'node:fs';
3
2
  import { cwd } from 'node:process';
4
- import { pathToFileURL } from 'node:url';
5
3
  import { fixupPluginRules } from '@eslint/compat';
6
4
  import eslintPluginJs from '@eslint/js';
7
5
  import eslintPluginJson from '@eslint/json';
@@ -20,15 +18,13 @@ import { configs as eslintPluginWebComponentsConfigs } from 'eslint-plugin-wc';
20
18
  import eslintTs from 'typescript-eslint';
21
19
  // collect gitignore excludes
22
20
  let gitIgnoreLines = [];
23
- try {
24
- const gitIgnores = await readFile(pathToFileURL(`${cwd()}/.gitignore`).href, 'utf-8');
21
+ const pathToGitIgnore = `${cwd()}/.gitignore`;
22
+ if (existsSync(pathToGitIgnore)) {
23
+ const gitIgnores = readFileSync(pathToGitIgnore, 'utf-8');
25
24
  gitIgnoreLines = gitIgnores
26
25
  .split('\n')
27
26
  .map(line => line.trim().replace(/^\//, ''))
28
- .filter(line => line && !line.startsWith('#'));
29
- }
30
- catch (error) {
31
- // noop - maybe a warning?
27
+ .filter(line => Boolean(line) && !line.startsWith('#'));
32
28
  }
33
29
  // shared parser options
34
30
  const parserOptions = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enke.dev/lint",
3
- "version": "0.10.7",
3
+ "version": "0.11.1",
4
4
  "description": "Meta package to provide linting for web projects",
5
5
  "homepage": "https://github.com/enke-dev/lint",
6
6
  "repository": {
@@ -11,6 +11,8 @@
11
11
  "eslint.config.d.ts",
12
12
  "eslint.config.js",
13
13
  "eslint-plugins.d.ts",
14
+ "prettier.config.d.ts",
15
+ "prettier.config.js",
14
16
  "stylelint.config.d.ts",
15
17
  "stylelint.config.js",
16
18
  "README.md"
@@ -47,6 +49,7 @@
47
49
  "typescript-eslint": "^8.43.0"
48
50
  },
49
51
  "dependencies": {
52
+ "@awmottaz/prettier-plugin-void-html": "1.9.0",
50
53
  "@eslint/compat": "1.3.2",
51
54
  "@eslint/js": "9.35.0",
52
55
  "@eslint/json": "0.13.2",
@@ -0,0 +1,3 @@
1
+ import type { Config } from 'prettier';
2
+ declare const config: Config;
3
+ export default config;
@@ -0,0 +1,13 @@
1
+ import * as voidHtml from '@awmottaz/prettier-plugin-void-html';
2
+ const config = {
3
+ arrowParens: 'avoid',
4
+ endOfLine: 'auto',
5
+ jsxSingleQuote: false,
6
+ printWidth: 100,
7
+ singleQuote: true,
8
+ tabWidth: 2,
9
+ trailingComma: 'es5',
10
+ useTabs: false,
11
+ plugins: [voidHtml],
12
+ };
13
+ export default config;
@@ -1,43 +0,0 @@
1
- declare module 'eslint-plugin-html' {
2
- import type { ESLint } from 'eslint';
3
-
4
- const plugin: ESLint.Plugin;
5
-
6
- export default plugin;
7
- }
8
-
9
- declare module 'eslint-plugin-import-extensions' {
10
- import type { ESLint } from 'eslint';
11
-
12
- const plugin: ESLint.Plugin;
13
-
14
- export default plugin;
15
- }
16
-
17
- declare module 'eslint-plugin-import' {
18
- import type { Linter } from 'eslint';
19
-
20
- export const js: {
21
- readonly flatConfigs: {
22
- readonly recommended: { readonly rules: Readonly<Linter.RulesRecord> };
23
- };
24
- };
25
-
26
- export default js;
27
- }
28
-
29
- declare module 'eslint-plugin-lit-a11y' {
30
- import type { ESLint, Linter } from 'eslint';
31
-
32
- export const configs: {
33
- readonly recommended: {
34
- readonly rules: Readonly<Linter.RulesRecord>;
35
- };
36
- };
37
-
38
- const plugin: ESLint.Plugin & {
39
- readonly configs;
40
- };
41
-
42
- export default plugin;
43
- }