Skip to content

检测代码中是否存在 es 语法或者 API;Check whether ES syntax and APIs are used in the code.

License

Notifications You must be signed in to change notification settings

Rabbitzzc/es-checker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

es-checker

Check ES6 ES7 ES8 ES9 ES10 ES11 ES12.....

Check whether ES syntax and APIs are used in the code.

In the actual development situation, there are some need to check whether the latest ES syntax are used in the code to  decide if compatibility processing is required, such as in mini-programs, some older websites, and so on.

Usage

Install

yarn add es-checker

How to use

function type

type ecmaCheck = (filesArgs: string | string[], target: EcmaVersionType = 'es6', config: ConfigType) => void

import

import ecmaCheck from 'es-checker'

file

// single file
ecmaCheck('a.js', 'es6')

// mut files
ecmaCheck(['a.js', 'b.js'], 'es6')

target

ecmaCheck('a.js', 'es7')

config: (fast-glob options)

ecmaCheck('a.js', 'es7', {
  dir: '',
  ignore: []
})

Type

EcmaVersionType

export type EcmaVersionType = 'es6' | 'es7' | 'es8' | 'es9' | 'es10' | 'es11' | 'es12' | 'es2015' | 'es2016' | 'es2017' | 'es2018' | 'es2019' | 'es2020' | 'es2021'

ConfigType

type ConfigType = {
  dir?: string;  // cwd
  ignore?: string | string[]; // some files to ignore
}

TODO

  • bin command support

About

检测代码中是否存在 es 语法或者 API;Check whether ES syntax and APIs are used in the code.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published