@lbenie/linting 1.4.0 → 1.5.0

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
@@ -16,20 +16,24 @@ or
16
16
  yarn add -D @lbenie/linting
17
17
  ```
18
18
 
19
- Then create a `.eslintrc.js` file at the root of your project and add the following
19
+ Then create a `eslint.config.js` file at the root of your project and add the following
20
20
 
21
21
  ```js
22
- module.exports = {
23
- extends: [require.resolve('@lbenie/linting/eslint')],
24
- };
22
+ import rules from '@lbenie/linting/eslint';
23
+
24
+ export default [
25
+ ...rules,
26
+ ]
25
27
  ```
26
28
 
27
- Then create a `.stylelintrc.js` file at the root of your project and add the following
29
+ Then create a `stylelint.config.cjs` file at the root of your project and add the following
28
30
 
29
31
  ```js
30
- module.exports = {
31
- extends: [require.resolve('@lbenie/linting/stylelint')],
32
- };
32
+ import rules from '@lbenie/linting/stylelint';
33
+
34
+ export default [
35
+ ...rules,
36
+ ]
33
37
  ```
34
38
 
35
39
  <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
@@ -0,0 +1,159 @@
1
+ import js from '@eslint/js'
2
+ import jsxA11y from 'eslint-plugin-jsx-a11y'
3
+ import globals from 'globals'
4
+ import jsdoc from 'eslint-plugin-jsdoc'
5
+ import tsElint from '@typescript-eslint/eslint-plugin'
6
+ import typescriptParser from '@typescript-eslint/parser'
7
+ import functional from 'eslint-plugin-functional'
8
+ import prettier from 'eslint-plugin-prettier'
9
+ import astroParser from 'astro-eslint-parser'
10
+ import astro from 'eslint-plugin-astro'
11
+ import litA11y from 'eslint-plugin-lit-a11y'
12
+
13
+ /**
14
+ * @type {Pick<import('eslint').Linter.FlatConfig, 'parserOptions' | 'ignores' | 'languageOptions'>}
15
+ */
16
+ const defaultOptions = {
17
+ ignores: ['node_modules/*'],
18
+ languageOptions: {
19
+ sourceType: 'module',
20
+ globals: {
21
+ ...globals.browser,
22
+ ...globals.node,
23
+ },
24
+ parserOptions: {
25
+ ecmaVersion: 'latest',
26
+ sourceType: 'module',
27
+ experimentalObjectRestSpread: true,
28
+ ecmaFeatures: {
29
+ jsx: true,
30
+ },
31
+ },
32
+ },
33
+ }
34
+
35
+ /**
36
+ * @type {import('eslint').Linter.FlatConfig['plugins']}
37
+ */
38
+ const defaultPlugins = {
39
+ functional,
40
+ jsdoc,
41
+ 'jsx-a11y': jsxA11y,
42
+ '@typescript-eslint': tsElint,
43
+ prettier,
44
+ 'lit-a11y': litA11y,
45
+ }
46
+
47
+ /**
48
+ * @type {import('eslint').Linter.FlatConfig['rules']}
49
+ */
50
+ const functionalrules = {
51
+ 'functional/prefer-tacit': ['error'],
52
+ 'functional/prefer-readonly-type': ['error'],
53
+ 'functional/readonly-type': ['error', 'keyword'],
54
+ 'functional/prefer-property-signatures': ['error'],
55
+ }
56
+
57
+ /**
58
+ * @type {import('eslint').Linter.FlatConfig['rules']}
59
+ */
60
+ const prettierRules = {
61
+ 'prettier/prettier': [
62
+ 'error',
63
+ { singleQuote: true, semi: false, trailingComma: 'all' },
64
+ ],
65
+ }
66
+
67
+ /**
68
+ * @type {import('eslint').Linter.FlatConfig['rules']}
69
+ */
70
+ const tsRules = {
71
+ '@typescript-eslint/no-unused-vars': 'off',
72
+ '@typescript-eslint/consistent-type-imports': [
73
+ 'error',
74
+ { fixStyle: 'inline-type-imports' },
75
+ ],
76
+ '@typescript-eslint/prefer-readonly': ['error'],
77
+ '@typescript-eslint/prefer-readonly-parameter-types': ['error'],
78
+ }
79
+
80
+ /**
81
+ * @type {import('eslint').Linter.FlatConfig['rules']}
82
+ */
83
+ const defaultRules = {
84
+ ...functionalrules,
85
+ ...prettierRules,
86
+ ...jsxA11y.configs.recommended.rules,
87
+ ...litA11y.configs.recommended.rules,
88
+ }
89
+
90
+ /**
91
+ * @type {import('eslint').Linter.FlatConfig[]}
92
+ */
93
+ const config = [
94
+ jsdoc.configs['flat/recommended'],
95
+ {
96
+ ...defaultOptions,
97
+ files: ['**/*.js', '**/*.jsx', '**/*.mjs', '**/*.cjs'],
98
+ rules: {
99
+ ...js.configs.recommended.rules,
100
+ ...defaultRules,
101
+ },
102
+ plugins: {
103
+ ...defaultPlugins,
104
+ },
105
+ },
106
+ {
107
+ ...defaultOptions,
108
+ files: ['**/*.ts', '**/*.tsx'],
109
+ rules: {
110
+ ...defaultRules,
111
+ ...tsElint.configs.recommended.rules,
112
+ ...tsElint.configs['recommended-requiring-type-checking'].rules,
113
+ ...tsRules,
114
+ },
115
+ languageOptions: {
116
+ ...defaultOptions.languageOptions,
117
+ parser: typescriptParser,
118
+ parserOptions: {
119
+ ...defaultOptions.languageOptions.parserOptions,
120
+ parser: typescriptParser,
121
+ project: ['./tsconfig.json'],
122
+ },
123
+ },
124
+ plugins: {
125
+ ...defaultPlugins,
126
+ },
127
+ },
128
+ {
129
+ ...defaultOptions,
130
+ files: ['**/*.astro', '**/*.astro/*.js', '*.astro/*.js'],
131
+ languageOptions: {
132
+ ...defaultOptions.languageOptions,
133
+ globals: {
134
+ ...defaultOptions.languageOptions.globals,
135
+ 'astro/astro': true,
136
+ },
137
+ parser: astroParser,
138
+ parserOptions: {
139
+ ...defaultOptions.languageOptions.parserOptions,
140
+ parser: typescriptParser,
141
+ project: ['./tsconfig.json'],
142
+ },
143
+ },
144
+ rules: {
145
+ ...defaultRules,
146
+ ...tsElint.configs.recommended.rules,
147
+ ...tsElint.configs['recommended-requiring-type-checking'].rules,
148
+ ...tsRules,
149
+ ...astro.configs.recommended.rules,
150
+ 'prettier/prettier': 'off',
151
+ },
152
+ plugins: {
153
+ ...defaultPlugins,
154
+ astro,
155
+ },
156
+ },
157
+ ]
158
+
159
+ export default config
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lbenie/linting",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "my opiniated rules",
5
5
  "repository": {
6
6
  "url": "https://github.com/lbenie/linting"
@@ -10,7 +10,7 @@
10
10
  "stylelint",
11
11
  "linting"
12
12
  ],
13
- "type": "commonjs",
13
+ "type": "module",
14
14
  "license": "MIT",
15
15
  "private": false,
16
16
  "files": [
@@ -32,6 +32,7 @@
32
32
  "access": "public"
33
33
  },
34
34
  "devDependencies": {
35
+ "@eslint/js": "8.54.0",
35
36
  "@semantic-release/changelog": "6.0.3",
36
37
  "@semantic-release/commit-analyzer": "11.1.0",
37
38
  "@semantic-release/git": "10.0.1",
@@ -41,6 +42,7 @@
41
42
  "@types/react": "18.2.38",
42
43
  "@types/semantic-release": "20.0.6",
43
44
  "all-contributors-cli": "6.26.1",
45
+ "astro": "3.6.0",
44
46
  "concurrently": "8.2.2",
45
47
  "conventional-changelog-conventionalcommits": "7.0.2",
46
48
  "lit": "3.1.0",
@@ -53,11 +55,13 @@
53
55
  "@typescript-eslint/eslint-plugin": "6.12.0",
54
56
  "@typescript-eslint/parser": "6.12.0",
55
57
  "eslint": "8.54.0",
56
- "eslint-plugin-astro": "^0.29.0",
58
+ "eslint-plugin-astro": "0.29.0",
57
59
  "eslint-plugin-functional": "6.0.0",
60
+ "eslint-plugin-jsdoc": "46.9.0",
58
61
  "eslint-plugin-jsx-a11y": "6.8.0",
59
62
  "eslint-plugin-lit-a11y": "4.1.1",
60
63
  "eslint-plugin-prettier": "5.0.1",
64
+ "globals": "13.23.0",
61
65
  "postcss": "8.4.31",
62
66
  "postcss-scss": "4.0.9",
63
67
  "postcss-styl": "0.12.3",
@@ -2,9 +2,7 @@
2
2
  * @type {import('stylelint').Config}
3
3
  */
4
4
  module.exports = {
5
- extends: [
6
- 'stylelint-order',
7
- ],
5
+ extends: ['stylelint-order'],
8
6
  plugins: ['stylelint-stylus', 'stylelint-order'],
9
7
  overrides: [
10
8
  {
@@ -1,102 +0,0 @@
1
- /**
2
- * @type {import('eslint').Linter.Config['rules']}
3
- */
4
- const tsRules = {
5
- '@typescript-eslint/no-unused-vars': 'off',
6
- '@typescript-eslint/consistent-type-imports': ['error', { fixStyle: 'inline-type-imports'}],
7
- '@typescript-eslint/prefer-readonly': ['error'],
8
- '@typescript-eslint/prefer-readonly-parameter-types': ['error'],
9
- }
10
-
11
- /**
12
- * @type {import('eslint').Linter.Config['rules']}
13
- */
14
- const functionalrules = {
15
- 'functional/prefer-tacit': ['error'],
16
- 'functional/prefer-readonly-type': ['error'],
17
- 'functional/readonly-type': ['error', 'keyword'],
18
- 'functional/prefer-property-signatures': ['error'],
19
- }
20
-
21
- /**
22
- * @type {import('eslint').Linter.Config['rules']}
23
- */
24
- const prettierRules = {
25
- 'prettier/prettier': [
26
- 'error',
27
- { singleQuote: true, semi: false, trailingComma: 'all' },
28
- ]
29
- }
30
-
31
- /**
32
- * @type {import('eslint').Linter.Config['extends']}
33
- */
34
- const a11yExtends = [
35
- 'plugin:jsx-a11y/recommended',
36
- 'plugin:lit-a11y/recommended',
37
- ]
38
-
39
- /**
40
- * @type {import('eslint').Linter.Config}
41
- */
42
- module.exports = {
43
- root: true,
44
- extends: [
45
- 'eslint:recommended',
46
- ],
47
- plugins: ['prettier', '@typescript-eslint', 'functional', 'jsx-a11y', 'lit-a11y'],
48
- env: {
49
- node: true,
50
- es6: true,
51
- },
52
- parserOptions: {
53
- ecmaVersion: 'latest',
54
- sourceType: 'module',
55
- experimentalObjectRestSpread: true,
56
- },
57
- overrides: [
58
- {
59
- files: ['*.ts', '*.tsx', '*.mjs', '*.cjs'],
60
- extends: [
61
- 'plugin:@typescript-eslint/recommended',
62
- 'plugin:@typescript-eslint/recommended-requiring-type-checking',
63
- ...a11yExtends,
64
- ],
65
- parserOptions: {
66
- parser: '@typescript-eslint/parser',
67
- project: ['./tsconfig.json'],
68
- ecmaFeatures: {
69
- jsx: true,
70
- }
71
- },
72
- parser: '@typescript-eslint/parser',
73
- rules: {
74
- ...prettierRules,
75
- ...tsRules,
76
- ...functionalrules
77
- },
78
- env: {
79
- browser: true,
80
- },
81
- },
82
- {
83
- files: ['*.astro'],
84
- parser: 'astro-eslint-parser',
85
- extends: [
86
- ...a11yExtends,
87
- 'plugin:astro/recommended'
88
- ],
89
- parserOptions: {
90
- project: ['./tsconfig.json'],
91
- extraFileExtensions: ['.astro'],
92
- },
93
- rules: {
94
- ...tsRules,
95
- ...functionalrules
96
- },
97
- env: {
98
- browser: true,
99
- },
100
- },
101
- ],
102
- }