@jcoreio/toolchain-flow 5.0.1 → 5.1.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.
@@ -1,18 +1,19 @@
1
1
  module.exports = {
2
- plugins: ['eslint-plugin-flowtype'],
2
+ parser: '@babel/eslint-parser',
3
+ plugins: ['ft-flow'],
3
4
  rules: {
4
- 'flowtype/boolean-style': [2, 'boolean'],
5
- 'flowtype/define-flow-type': 1,
6
- 'flowtype/delimiter-dangle': [2, 'always-multiline'],
7
- 'flowtype/no-dupe-keys': 2,
8
- 'flowtype/no-primitive-constructor-types': 2,
9
- 'flowtype/require-parameter-type': [
5
+ 'ft-flow/boolean-style': [2, 'boolean'],
6
+ 'ft-flow/define-flow-type': 1,
7
+ 'ft-flow/delimiter-dangle': [2, 'always-multiline'],
8
+ 'ft-flow/no-dupe-keys': 2,
9
+ 'ft-flow/no-primitive-constructor-types': 2,
10
+ 'ft-flow/require-parameter-type': [
10
11
  2,
11
12
  {
12
13
  excludeArrowFunctions: 'expressionsOnly',
13
14
  },
14
15
  ],
15
- 'flowtype/require-return-type': [
16
+ 'ft-flow/require-return-type': [
16
17
  2,
17
18
  'always',
18
19
  {
@@ -20,22 +21,22 @@ module.exports = {
20
21
  excludeArrowFunctions: 'expressionsOnly',
21
22
  },
22
23
  ],
23
- 'flowtype/require-valid-file-annotation': 2,
24
- 'flowtype/semi': [2, 'never'],
25
- 'flowtype/space-after-type-colon': [
24
+ 'ft-flow/require-valid-file-annotation': 2,
25
+ 'ft-flow/semi': [2, 'never'],
26
+ 'ft-flow/space-after-type-colon': [
26
27
  2,
27
28
  'always',
28
29
  {
29
30
  allowLineBreak: true,
30
31
  },
31
32
  ],
32
- 'flowtype/space-before-generic-bracket': [2, 'never'],
33
- 'flowtype/space-before-type-colon': [2, 'never'],
34
- 'flowtype/union-intersection-spacing': [2, 'always'],
35
- 'flowtype/use-flow-type': 1,
33
+ 'ft-flow/space-before-generic-bracket': [2, 'never'],
34
+ 'ft-flow/space-before-type-colon': [2, 'never'],
35
+ 'ft-flow/union-intersection-spacing': [2, 'always'],
36
+ // 'ft-flow/use-flow-type': 1,
36
37
  },
37
38
  settings: {
38
- flowtype: {
39
+ 'ft-flow': {
39
40
  onlyFilesWithFlowAnnotation: true,
40
41
  },
41
42
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jcoreio/toolchain-flow",
3
- "version": "5.0.1",
3
+ "version": "5.1.0",
4
4
  "description": "Flow JS build toolchain",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,22 +14,23 @@
14
14
  },
15
15
  "homepage": "https://github.com/jcoreio/toolchains/tree/main/packages/flow",
16
16
  "dependencies": {
17
- "@babel/core": "^7.16.5",
18
- "@babel/plugin-syntax-flow": "^7.14.5",
19
- "@babel/plugin-transform-react-jsx": "^7.14.9",
20
- "@babel/preset-flow": "^7.16.5",
17
+ "@babel/core": "^7.26.0",
18
+ "@babel/plugin-syntax-flow": "^7.26.0",
19
+ "@babel/plugin-transform-react-jsx": "^7.25.9",
20
+ "@babel/preset-flow": "^7.25.9",
21
21
  "dedent-js": "^1.0.1",
22
- "eslint": "^8.56.0",
23
- "eslint-plugin-flowtype": "^8.0.3",
24
- "@jcoreio/toolchain": "5.0.1",
25
- "@jcoreio/toolchain-esnext": "5.0.1"
22
+ "eslint": "^9.17.0",
23
+ "eslint-plugin-ft-flow": "^3.0.11",
24
+ "semver": "^7.5.3",
25
+ "@jcoreio/toolchain": "5.1.0",
26
+ "@jcoreio/toolchain-esnext": "5.1.0"
26
27
  },
27
28
  "toolchainManaged": {
28
29
  "devDependencies": {
29
30
  "@jcoreio/toolchain-esnext": "*",
30
31
  "@babel/plugin-syntax-flow": "*",
31
32
  "@babel/plugin-transform-react-jsx": "*",
32
- "eslint-plugin-flowtype": "*"
33
+ "eslint-plugin-ft-flow": "*"
33
34
  }
34
35
  }
35
36
  }
@@ -1,11 +1,13 @@
1
1
  const dedent = require('dedent-js')
2
2
  const fs = require('@jcoreio/toolchain/util/projectFs.cjs')
3
3
  const INI = require('@jcoreio/toolchain/util/ini.cjs')
4
+ const semver = require('semver')
4
5
 
5
6
  const defaultFlowConfig = dedent`
6
7
  [ignore]
7
8
  <PROJECT_ROOT>/dist/.*
8
9
  .*/malformed_package_json/.*
10
+ .*/node_modules/.*/hermes-.*/.*
9
11
 
10
12
  [include]
11
13
  ./src
@@ -21,12 +23,17 @@ module.exports = [
21
23
  let flowconfig
22
24
  if (await fs.pathExists('.flowconfig')) {
23
25
  flowconfig = await fs.readFile('.flowconfig', 'utf8')
24
- if (fromVersion) return { '.flowconfig': flowconfig }
26
+ if (fromVersion && semver.gte(fromVersion, '5.1.0')) {
27
+ return { '.flowconfig': flowconfig }
28
+ }
25
29
  const parsed = INI.parse(flowconfig)
26
30
  const parsedDefault = INI.parse(defaultFlowConfig)
27
31
 
28
32
  let changed = false
29
33
  for (const key in parsedDefault) {
34
+ if (fromVersion && key === 'include') {
35
+ continue
36
+ }
30
37
  if (parsed[key]) {
31
38
  for (const item of parsedDefault[key]) {
32
39
  if (!parsed[key].includes(item)) {
@@ -0,0 +1,10 @@
1
+ module.exports = [
2
+ () => [
3
+ {
4
+ files: ['*.js', '*.cjs', '*.mjs', '*.jsx'],
5
+ options: {
6
+ parser: 'flow',
7
+ },
8
+ },
9
+ ],
10
+ ]