@momsfriendlydevco/eslint-config 1.0.9 → 2.0.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.
Files changed (3) hide show
  1. package/README.md +22 -16
  2. package/index.js +120 -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,3 +1,7 @@
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/>
@@ -6,147 +10,135 @@ let jsCommonRules = {
6
10
  'no-unused-vars': ['warn'], // Dont make unused vars the end of the world
7
11
  };
8
12
 
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: [
13
+ export default [
14
+ pluginJSDoc.configs['flat/recommended'],
15
+ ...pluginVue.configs['flat/recommended'],
26
16
 
27
- // .doop backend Files {{{
28
- {
29
- files: ['*.doop'],
30
- parser: 'vue-eslint-parser',
17
+ // .doop backend Files {{{
18
+ {
19
+ files: ['**/*.doop'],
20
+ languageOptions: {
21
+ parser: eslintParser,
31
22
  globals: {
32
23
  app: 'readable', // Global backend App object
33
24
  db: 'readable', // Global app.db shortcut
34
25
  },
35
- rules: {
36
- 'vue/comment-directive': ['off'], // Screws up block parsing and we don't have <template/> anyway
37
- ...jsCommonRules,
38
- },
39
26
  },
40
- // }}}
27
+ rules: {
28
+ 'vue/comment-directive': ['off'], // Screws up block parsing and we don't have <template/> anyway
29
+ ...jsCommonRules,
30
+ },
31
+ },
32
+ // }}}
41
33
 
42
- // .mjs / .js regular files {{{
43
- {
44
- files: ['*.js', '*.mjs'],
45
- rules: {
46
- ...jsCommonRules,
47
- },
34
+ // .mjs / .js regular files {{{
35
+ {
36
+ files: ['**/*.js', '**/*.mjs'],
37
+ rules: {
38
+ ...jsCommonRules,
48
39
  },
49
- // }}}
40
+ },
41
+ // }}}
50
42
 
51
- // .vue frontend Files {{{
52
- {
53
- files: ['*.vue'],
54
- parser: 'vue-eslint-parser',
55
- parserOptions: {
56
- vueFeatures: {
57
- filter: true,
58
- },
59
- },
43
+ // .vue frontend Files {{{
44
+ {
45
+ files: ['**/*.vue'],
46
+ languageOptions: {
60
47
  globals: {
61
48
  $: 'readable', // jQuery
62
49
  _: 'readable', // Lodash
63
50
  app: 'readable', // Global frontend app object
64
51
  },
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,
52
+ parser: eslintParser,
53
+ parserOptions: {
54
+ vueFeatures: {
55
+ filter: true,
56
+ },
147
57
  },
148
58
  },
149
- // }}}
150
-
151
- ],
152
- }
59
+ rules: {
60
+ 'vue/attributes-order': ['warn', {
61
+ 'order': [
62
+ 'DEFINITION',
63
+ 'LIST_RENDERING',
64
+ 'CONDITIONALS',
65
+ 'RENDER_MODIFIERS',
66
+ 'GLOBAL',
67
+ ['UNIQUE', 'SLOT'],
68
+ 'TWO_WAY_BINDING',
69
+ [
70
+ 'ATTR_DYNAMIC',
71
+ 'ATTR_STATIC',
72
+ 'ATTR_SHORTHAND_BOOL',
73
+ 'EVENTS',
74
+ 'OTHER_DIRECTIVES',
75
+ 'CONTENT',
76
+ ],
77
+ ],
78
+ 'alphabetical': false,
79
+ }],
80
+ 'vue/component-definition-name-casing': ['warn', 'PascalCase'],
81
+ 'vue/html-closing-bracket-spacing': ['warn', {
82
+ selfClosingTag: 'never'
83
+ }],
84
+ 'vue/html-indent': ['error', 'tab'],
85
+ 'vue/html-self-closing': ['warn', {
86
+ html: {
87
+ void: 'always',
88
+ normal: 'any',
89
+ component: 'always',
90
+ },
91
+ }],
92
+ 'vue/max-attributes-per-line': ['warn', {
93
+ singleline: 4,
94
+ multiline: 1,
95
+ }],
96
+ 'vue/multi-word-component-names': ['off'],
97
+ 'vue/multiline-html-element-content-newline': ['warn', {
98
+ allowEmptyLines: true,
99
+ }],
100
+ 'vue/mustache-interpolation-spacing': ['warn', 'never'],
101
+ 'vue/order-in-components': ['warn', {
102
+ 'order': [
103
+ 'el',
104
+ 'name',
105
+ 'key',
106
+ 'parent',
107
+ 'functional',
108
+ ['delimiters', 'comments'],
109
+ ['components', 'directives', 'emits', 'filters'],
110
+ 'extends',
111
+ 'mixins',
112
+ ['provide', 'inject'],
113
+ 'ROUTER_GUARDS',
114
+ 'layout',
115
+ 'middleware',
116
+ 'validate',
117
+ 'scrollToTop',
118
+ 'transition',
119
+ 'loading',
120
+ 'inheritAttrs',
121
+ 'model',
122
+ ['data', 'asyncData', 'props', 'propsData'],
123
+ 'computed',
124
+ 'setup',
125
+ 'fetch',
126
+ 'head',
127
+ 'methods',
128
+ 'LIFECYCLE_HOOKS',
129
+ 'watch',
130
+ 'watchQuery',
131
+ ['template', 'render'],
132
+ 'renderError'
133
+ ]
134
+ }],
135
+ 'vue/require-default-prop': ['off'],
136
+ 'vue/singleline-html-element-content-newline': ['warn', {
137
+ ignoreWhenNoAttributes: true,
138
+ ignores: ['pre', 'textarea', 'div', 'INLINE_ELEMENTS'],
139
+ }],
140
+ ...jsCommonRules,
141
+ },
142
+ },
143
+ // }}}
144
+ ]
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.0",
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
  }