@momsfriendlydevco/eslint-config 1.0.9 → 2.0.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.
Files changed (3) hide show
  1. package/README.md +22 -16
  2. package/index.js +123 -128
  3. package/package.json +9 -11
package/README.md CHANGED
@@ -4,22 +4,28 @@ ESLint Rules for Mom's Friendly Dev Co.
4
4
 
5
5
  Installation
6
6
  ------------
7
- Merge the following into `package.json`:
7
+ 1. Install version 9 or above of eslint + this package
8
8
 
9
- ```json
10
- {
11
- "scripts": {
12
- "lint": "eslint --ext .doop --ext .js --ext .vue ."
13
- },
14
- "eslintConfig": {
15
- "extends": [
16
- "@momsfriendlydevco"
17
- ],
18
- "parserOptions": {
19
- "ecmaVersion": "latest"
20
- }
21
- }
22
- }
9
+ ```shell
10
+ npm i -D eslint @momsfriendlydevco/eslint-config
23
11
  ```
24
12
 
25
- See [@Doop/ESM-Loader](https://github.com/MomsFriendlyDevCo/doop-esm-loader) for more integration details.
13
+ 2. Add this template `eslint.config.js` file to the root of your main module / project:
14
+
15
+
16
+ ```javascript
17
+ import RulesMFDC from '@momsfriendlydevco/eslint-config';
18
+
19
+ export default [
20
+ {
21
+ // Global ignore rules - Do not add any other keys to this object or eslint doesn't treat this as global
22
+ ignores: [
23
+ '.*',
24
+ 'docs/',
25
+ 'dist/',
26
+ 'node_modules/',
27
+ ],
28
+ },
29
+ ...RulesMFDC,
30
+ ]
31
+ ```
package/index.js CHANGED
@@ -1,152 +1,147 @@
1
+ import eslintParser from 'vue-eslint-parser';
2
+ import pluginJSDoc from 'eslint-plugin-jsdoc';
3
+ import pluginVue from 'eslint-plugin-vue';
4
+
1
5
  // Rules shared by both .doop + .vue files
2
6
  let jsCommonRules = {
3
7
  'html-closing-bracket-spacing': ['off'], // Annoying doesn't allow <this-kind-of-thing/>
8
+ 'jsdoc/check-alignment': ['off'], // Disable the JSDoc parser insisting on correct indents
9
+ 'jsdoc/check-types': ['off'], // Disable the JSDoc parser being fussy about `@param {String}` vs `@param {string}`
10
+ 'jsdoc/tag-lines': ['off'], // Disable the JSDoc parser being fussy about new-line spacing
4
11
  'no-debugger': ['warn'], // Debuggers are fine, just warn
5
12
  'no-useless-escape': ['off'], // ESlint frequently gets what should and shouldn't be escaped wrong
6
13
  'no-unused-vars': ['warn'], // Dont make unused vars the end of the world
7
14
  };
8
15
 
9
- module.exports = {
10
- extends: [
11
- 'plugin:vue/recommended',
12
- 'eslint:recommended',
13
- ],
14
- env: {
15
- es6: true,
16
- mocha: true,
17
- node: true,
18
- },
19
- parserOptions: {
20
- ecmaVersion: 'latest',
21
- },
22
- plugins: [
23
- 'jsdoc',
24
- ],
25
- overrides: [
16
+ export default [
17
+ pluginJSDoc.configs['flat/recommended'],
18
+ ...pluginVue.configs['flat/recommended'],
26
19
 
27
- // .doop backend Files {{{
28
- {
29
- files: ['*.doop'],
30
- parser: 'vue-eslint-parser',
20
+ // .doop backend Files {{{
21
+ {
22
+ files: ['**/*.doop'],
23
+ languageOptions: {
24
+ parser: eslintParser,
31
25
  globals: {
32
26
  app: 'readable', // Global backend App object
33
27
  db: 'readable', // Global app.db shortcut
34
28
  },
35
- rules: {
36
- 'vue/comment-directive': ['off'], // Screws up block parsing and we don't have <template/> anyway
37
- ...jsCommonRules,
38
- },
39
29
  },
40
- // }}}
30
+ rules: {
31
+ 'vue/comment-directive': ['off'], // Screws up block parsing and we don't have <template/> anyway
32
+ ...jsCommonRules,
33
+ },
34
+ },
35
+ // }}}
41
36
 
42
- // .mjs / .js regular files {{{
43
- {
44
- files: ['*.js', '*.mjs'],
45
- rules: {
46
- ...jsCommonRules,
47
- },
37
+ // .mjs / .js regular files {{{
38
+ {
39
+ files: ['**/*.js', '**/*.mjs'],
40
+ rules: {
41
+ ...jsCommonRules,
48
42
  },
49
- // }}}
43
+ },
44
+ // }}}
50
45
 
51
- // .vue frontend Files {{{
52
- {
53
- files: ['*.vue'],
54
- parser: 'vue-eslint-parser',
55
- parserOptions: {
56
- vueFeatures: {
57
- filter: true,
58
- },
59
- },
46
+ // .vue frontend Files {{{
47
+ {
48
+ files: ['**/*.vue'],
49
+ languageOptions: {
60
50
  globals: {
61
51
  $: 'readable', // jQuery
62
52
  _: 'readable', // Lodash
63
53
  app: 'readable', // Global frontend app object
64
54
  },
65
- rules: {
66
- 'vue/attributes-order': ['warn', {
67
- 'order': [
68
- 'DEFINITION',
69
- 'LIST_RENDERING',
70
- 'CONDITIONALS',
71
- 'RENDER_MODIFIERS',
72
- 'GLOBAL',
73
- ['UNIQUE', 'SLOT'],
74
- 'TWO_WAY_BINDING',
75
- [
76
- 'ATTR_DYNAMIC',
77
- 'ATTR_STATIC',
78
- 'ATTR_SHORTHAND_BOOL',
79
- 'EVENTS',
80
- 'OTHER_DIRECTIVES',
81
- 'CONTENT',
82
- ],
83
- ],
84
- 'alphabetical': false,
85
- }],
86
- 'vue/component-definition-name-casing': ['off', 'PascalCase'], // FIXME: Doesn't support camelCase yet
87
- 'vue/html-closing-bracket-spacing': ['warn', {
88
- selfClosingTag: 'never'
89
- }],
90
- 'vue/html-indent': ['error', 'tab'],
91
- 'vue/html-self-closing': ['warn', {
92
- html: {
93
- void: 'always',
94
- normal: 'any',
95
- component: 'always',
96
- },
97
- }],
98
- 'vue/max-attributes-per-line': ['warn', {
99
- singleline: 4,
100
- multiline: 1,
101
- }],
102
- 'vue/multi-word-component-names': ['off'],
103
- 'vue/multiline-html-element-content-newline': ['warn', {
104
- allowEmptyLines: true,
105
- }],
106
- 'vue/mustache-interpolation-spacing': ['warn', 'never'],
107
- 'vue/order-in-components': ['warn', {
108
- 'order': [
109
- 'el',
110
- 'name',
111
- 'key',
112
- 'parent',
113
- 'functional',
114
- ['delimiters', 'comments'],
115
- ['components', 'directives', 'emits', 'filters'],
116
- 'extends',
117
- 'mixins',
118
- ['provide', 'inject'],
119
- 'ROUTER_GUARDS',
120
- 'layout',
121
- 'middleware',
122
- 'validate',
123
- 'scrollToTop',
124
- 'transition',
125
- 'loading',
126
- 'inheritAttrs',
127
- 'model',
128
- ['data', 'asyncData', 'props', 'propsData'],
129
- 'computed',
130
- 'setup',
131
- 'fetch',
132
- 'head',
133
- 'methods',
134
- 'LIFECYCLE_HOOKS',
135
- 'watch',
136
- 'watchQuery',
137
- ['template', 'render'],
138
- 'renderError'
139
- ]
140
- }],
141
- 'vue/require-default-prop': ['off'],
142
- 'vue/singleline-html-element-content-newline': ['warn', {
143
- ignoreWhenNoAttributes: true,
144
- ignores: ['pre', 'textarea', 'div', 'INLINE_ELEMENTS'],
145
- }],
146
- ...jsCommonRules,
55
+ parser: eslintParser,
56
+ parserOptions: {
57
+ vueFeatures: {
58
+ filter: true,
59
+ },
147
60
  },
148
61
  },
149
- // }}}
150
-
151
- ],
152
- }
62
+ rules: {
63
+ 'vue/attributes-order': ['warn', {
64
+ 'order': [
65
+ 'DEFINITION',
66
+ 'LIST_RENDERING',
67
+ 'CONDITIONALS',
68
+ 'RENDER_MODIFIERS',
69
+ 'GLOBAL',
70
+ ['UNIQUE', 'SLOT'],
71
+ 'TWO_WAY_BINDING',
72
+ [
73
+ 'ATTR_DYNAMIC',
74
+ 'ATTR_STATIC',
75
+ 'ATTR_SHORTHAND_BOOL',
76
+ 'EVENTS',
77
+ 'OTHER_DIRECTIVES',
78
+ 'CONTENT',
79
+ ],
80
+ ],
81
+ 'alphabetical': false,
82
+ }],
83
+ 'vue/component-definition-name-casing': ['warn', 'PascalCase'],
84
+ 'vue/html-closing-bracket-spacing': ['warn', {
85
+ selfClosingTag: 'never'
86
+ }],
87
+ 'vue/html-indent': ['error', 'tab'],
88
+ 'vue/html-self-closing': ['warn', {
89
+ html: {
90
+ void: 'always',
91
+ normal: 'any',
92
+ component: 'always',
93
+ },
94
+ }],
95
+ 'vue/max-attributes-per-line': ['warn', {
96
+ singleline: 4,
97
+ multiline: 1,
98
+ }],
99
+ 'vue/multi-word-component-names': ['off'],
100
+ 'vue/multiline-html-element-content-newline': ['warn', {
101
+ allowEmptyLines: true,
102
+ }],
103
+ 'vue/mustache-interpolation-spacing': ['warn', 'never'],
104
+ 'vue/order-in-components': ['warn', {
105
+ 'order': [
106
+ 'el',
107
+ 'name',
108
+ 'key',
109
+ 'parent',
110
+ 'functional',
111
+ ['delimiters', 'comments'],
112
+ ['components', 'directives', 'emits', 'filters'],
113
+ 'extends',
114
+ 'mixins',
115
+ ['provide', 'inject'],
116
+ 'ROUTER_GUARDS',
117
+ 'layout',
118
+ 'middleware',
119
+ 'validate',
120
+ 'scrollToTop',
121
+ 'transition',
122
+ 'loading',
123
+ 'inheritAttrs',
124
+ 'model',
125
+ ['data', 'asyncData', 'props', 'propsData'],
126
+ 'computed',
127
+ 'setup',
128
+ 'fetch',
129
+ 'head',
130
+ 'methods',
131
+ 'LIFECYCLE_HOOKS',
132
+ 'watch',
133
+ 'watchQuery',
134
+ ['template', 'render'],
135
+ 'renderError'
136
+ ]
137
+ }],
138
+ 'vue/require-default-prop': ['off'],
139
+ 'vue/singleline-html-element-content-newline': ['warn', {
140
+ ignoreWhenNoAttributes: true,
141
+ ignores: ['pre', 'textarea', 'div', 'INLINE_ELEMENTS'],
142
+ }],
143
+ ...jsCommonRules,
144
+ },
145
+ },
146
+ // }}}
147
+ ]
package/package.json CHANGED
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "name": "@momsfriendlydevco/eslint-config",
3
- "version": "1.0.9",
4
3
  "description": "ESLint plugin for @MomsFriendlyDevCo projects",
5
- "main": "index.js",
4
+ "version": "2.0.1",
5
+ "type": "module",
6
6
  "scripts": {
7
7
  "test": "eslint --config index.js test/data"
8
8
  },
9
+ "exports": {
10
+ ".": "./index.js"
11
+ },
9
12
  "repository": {
10
13
  "type": "git",
11
14
  "url": "git+https://github.com/MomsFriendlyDevCo/eslint.git"
@@ -21,16 +24,11 @@
21
24
  },
22
25
  "homepage": "https://github.com/MomsFriendlyDevCo/eslint#readme",
23
26
  "dependencies": {
24
- "eslint-plugin-jsdoc": "^46.8.2",
25
- "eslint-plugin-vue": "^9.18.1"
27
+ "eslint-plugin-jsdoc": "^48.2.3",
28
+ "eslint-plugin-vue": "^9.25.0",
29
+ "vue-eslint-parser": "^9.4.2"
26
30
  },
27
31
  "peerDependencies": {
28
- "eslint": "^8.37.0"
29
- },
30
- "eslintConfig": {
31
- "extends": "./index.js",
32
- "parserOptions": {
33
- "ecmaVersion": "latest"
34
- }
32
+ "eslint": ">=9.2.0"
35
33
  }
36
34
  }