shinkansen-sprockets 1.1.437 → 1.1.440

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.
@@ -0,0 +1,184 @@
1
+ import globals from 'globals'
2
+ import standard from '@sequencemedia/eslint-config-standard/configs/recommended/merge'
3
+ import typescript from '@sequencemedia/eslint-config-typescript/configs/recommended/merge'
4
+ import babelParser from '@babel/eslint-parser'
5
+ import typescriptParser from '@typescript-eslint/parser'
6
+ import reactPlugin from 'eslint-plugin-react'
7
+ import storybookPlugin from 'eslint-plugin-storybook'
8
+
9
+ const reactParserOptions = {
10
+ ecmaFeatures: {
11
+ jsx: true
12
+ }
13
+ }
14
+
15
+ const reactPlugins = {
16
+ react: reactPlugin
17
+ }
18
+
19
+ const storybookPlugins = {
20
+ storybook: storybookPlugin
21
+ }
22
+
23
+ const reactRules = {
24
+ 'no-unused-vars': [
25
+ 'error',
26
+ {
27
+ varsIgnorePattern: 'React'
28
+ }
29
+ ],
30
+ quotes: [
31
+ 'error',
32
+ 'single'
33
+ ],
34
+ 'jsx-quotes': [
35
+ 'error',
36
+ 'prefer-single'
37
+ ],
38
+ 'react/jsx-indent': [
39
+ 'error',
40
+ 2,
41
+ {
42
+ checkAttributes: true,
43
+ indentLogicalExpressions: true
44
+ }
45
+ ]
46
+ }
47
+
48
+ const reactSettings = {
49
+ react: {
50
+ version: 'detect'
51
+ }
52
+ }
53
+
54
+ export default [
55
+ /**
56
+ * React config for all `jsx` and `tsx` files
57
+ */
58
+ {
59
+ ...reactPlugin.configs.flat.recommended,
60
+ settings: {
61
+ ...reactPlugin.configs.flat.recommended.settings,
62
+ ...reactSettings
63
+ }
64
+ },
65
+ /**
66
+ * Storybook config
67
+ */
68
+ ...storybookPlugin.configs['flat/recommended'],
69
+ /**
70
+ * Standard config
71
+ */
72
+ standard({
73
+ files: [
74
+ '**/*.{mjs,cjs,mts,cts}'
75
+ ],
76
+ ignores: [
77
+ 'src',
78
+ 'stories'
79
+ ],
80
+ languageOptions: {
81
+ globals: {
82
+ ...globals.node
83
+ }
84
+ }
85
+ }),
86
+ standard({
87
+ files: [
88
+ 'src/**/*.{mjs,cjs,mts,cts}',
89
+ 'stories/**/*.{mjs,cjs,mts,cts}'
90
+ ],
91
+ languageOptions: {
92
+ globals: {
93
+ ...globals.browser
94
+ }
95
+ }
96
+ }),
97
+ /**
98
+ * Standard config for all `jsx` and `tsx` files
99
+ */
100
+ standard({
101
+ files: [
102
+ 'src/**/*.tsx',
103
+ 'stories/**/*.jsx'
104
+ ],
105
+ languageOptions: {
106
+ parser: babelParser,
107
+ parserOptions: {
108
+ ...reactParserOptions,
109
+ project: null
110
+ },
111
+ globals: {
112
+ ...globals.browser
113
+ }
114
+ },
115
+ plugins: {
116
+ ...reactPlugins,
117
+ ...storybookPlugins
118
+ },
119
+ rules: {
120
+ ...reactRules
121
+ },
122
+ settings: {
123
+ ...reactSettings,
124
+ 'import/resolver': {
125
+ 'babel-module': {}
126
+ }
127
+ }
128
+ }),
129
+ /**
130
+ * TypeScript config
131
+ */
132
+ typescript({
133
+ files: [
134
+ '**/*.{mts,cts}'
135
+ ],
136
+ ignores: [
137
+ 'src'
138
+ ],
139
+ languageOptions: {
140
+ globals: {
141
+ ...globals.node,
142
+ SprocketsTypes: 'readonly'
143
+ }
144
+ }
145
+ }),
146
+ typescript({
147
+ files: [
148
+ 'src/**/*.{mts,cts}'
149
+ ],
150
+ languageOptions: {
151
+ globals: {
152
+ ...globals.browser
153
+ }
154
+ }
155
+ }),
156
+ /**
157
+ * TypeScript config for only `tsx` files
158
+ */
159
+ typescript({
160
+ files: [
161
+ 'src/**/*.tsx'
162
+ ],
163
+ languageOptions: {
164
+ parser: typescriptParser,
165
+ parserOptions: {
166
+ ...reactParserOptions,
167
+ projectService: true,
168
+ project: 'tsconfig.json'
169
+ },
170
+ globals: {
171
+ ...globals.browser
172
+ }
173
+ },
174
+ plugins: {
175
+ ...reactPlugins
176
+ },
177
+ rules: {
178
+ ...reactRules
179
+ },
180
+ settings: {
181
+ ...reactSettings
182
+ }
183
+ })
184
+ ]
package/index.d.mts ADDED
@@ -0,0 +1,37 @@
1
+ declare global {
2
+ namespace SprocketsTypes {
3
+ export type OnChangeType = () => void
4
+
5
+ export interface AnswerDefinitionType {
6
+ answer: {
7
+ title: string
8
+ value: string | string[]
9
+ }
10
+ changeAnswer: {
11
+ text: string
12
+ href: string
13
+ visuallyHiddenText?: string
14
+ }
15
+ }
16
+
17
+ export interface ErrorDefinitionType {
18
+ type: string
19
+ uri: string
20
+ params: {
21
+ expectedType: string
22
+ }
23
+ }
24
+
25
+ export interface FieldChangeType {
26
+ text: string
27
+ href: string
28
+ }
29
+
30
+ export interface FieldErrorType {
31
+ text: string
32
+ href: string
33
+ }
34
+ }
35
+ }
36
+
37
+ export {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shinkansen-sprockets",
3
- "version": "1.1.437",
3
+ "version": "1.1.440",
4
4
  "description": "Shinkansen Sprockets",
5
5
  "keywords": [
6
6
  "Shinkansen",
@@ -30,7 +30,7 @@
30
30
  "build": "cross-env DEBUG=shinkansen-sprockets* webpack",
31
31
  "build-storybook": "storybook build",
32
32
  "build:watch": "cross-env DEBUG=shinkansen-sprockets* webpack --watch",
33
- "lint": "eslint . .storybook --ext .mjs,.cjs,.jsx,.mts,.cts",
33
+ "lint": "eslint",
34
34
  "lint:fix": "npm run lint -- --fix",
35
35
  "nvm": "bash nvm.sh",
36
36
  "prelint": "npm run nvm",
@@ -44,7 +44,7 @@
44
44
  },
45
45
  "dependencies": {
46
46
  "classnames": "^2.5.1",
47
- "debug": "^4.3.7",
47
+ "debug": "^4.4.0",
48
48
  "fast-deep-equal": "^3.1.3"
49
49
  },
50
50
  "devDependencies": {
@@ -53,23 +53,26 @@
53
53
  "@babel/preset-env": "^7.26.0",
54
54
  "@babel/preset-react": "^7.26.3",
55
55
  "@babel/register": "^7.25.9",
56
- "@modernpoacher/design-system": "1.1.18",
56
+ "@modernpoacher/design-system": "1.1.21",
57
+ "@sequencemedia/eslint-config-standard": "^0.2.10",
58
+ "@sequencemedia/eslint-config-typescript": "^0.1.15",
57
59
  "@storybook/addon-actions": "7.6.20",
58
60
  "@storybook/addon-essentials": "7.6.20",
59
61
  "@storybook/addon-links": "7.6.20",
60
62
  "@storybook/react": "7.6.20",
61
63
  "@storybook/react-webpack5": "7.6.20",
62
64
  "@types/react": "^18.3.13",
63
- "@typescript-eslint/eslint-plugin": "7.18.0",
64
- "@typescript-eslint/parser": "7.18.0",
65
+ "@typescript-eslint/eslint-plugin": "^8.19.1",
66
+ "@typescript-eslint/parser": "^8.19.1",
65
67
  "autoprefixer": "^10.4.20",
66
68
  "clean-webpack-plugin": "^4.0.0",
67
69
  "core-js": "^3.39.0",
68
70
  "cross-env": "^7.0.3",
69
- "eslint": "8.57.1",
70
- "eslint-config-love": "47.0.0",
71
- "eslint-config-standard": "^17.1.0",
72
- "eslint-plugin-react": "^7.37.2",
71
+ "eslint": "^9.17.0",
72
+ "eslint-import-resolver-babel-module": "^5.3.2",
73
+ "eslint-plugin-react": "^7.37.3",
74
+ "eslint-plugin-storybook": "^0.11.2",
75
+ "globals": "^15.14.0",
73
76
  "husky": "^9.1.7",
74
77
  "jest": "^29.7.0",
75
78
  "mini-css-extract-plugin": "^2.9.2",
package/src/index.d.mts CHANGED
@@ -1,37 +1,3 @@
1
- declare namespace SprocketsTypes {
2
- export type OnChangeType = () => void
3
-
4
- export interface AnswerDefinitionType {
5
- answer: {
6
- title: string
7
- value: string | string[]
8
- }
9
- changeAnswer: {
10
- text: string
11
- href: string
12
- visuallyHiddenText?: string
13
- }
14
- }
15
-
16
- export interface ErrorDefinitionType {
17
- type: string
18
- uri: string
19
- params: {
20
- expectedType: string
21
- }
22
- }
23
-
24
- export interface FieldChangeType {
25
- text: string
26
- href: string
27
- }
28
-
29
- export interface FieldErrorType {
30
- text: string
31
- href: string
32
- }
33
- }
34
-
35
1
  declare module '#sprockets' {
36
2
  export { default as CheckAnswersSprocket } from '#sprockets/sprockets/check-answers'
37
3
  export { default as ErrorSummarySprocket } from '#sprockets/sprockets/error-summary'
@@ -21,6 +21,6 @@ export function getKey (href, text, index) {
21
21
  .replace(/[^\w\-\d]/g, CHAR32).trim()
22
22
  .replace(/\s\s+/g, CHAR32)
23
23
  .replace(/\-\-+/g, CHAR45) // eslint-disable-line
24
- .replace(/[\s\s|\-\-|\s\-|\-\s]+/g, CHAR45) // eslint-disable-line
24
+ .replace(/[\s\s|\-\-|\s\-|\-\s]+/g, CHAR45)
25
25
  )
26
26
  }