import path from 'path' ; import fs from 'fs' ; import { Context , Diagnostic } from '../interfaces' ; import { getJSONPropertyPosition } from '../utils' ; param context returns export default ( context ) : Diagnostic [ ] => { const { pkg } = context ; if ( ! pkg . types && pkg . typings ) { const packageJsonFullPath = path . join ( context . cwd , 'package.json' ) ; const content = fs . readFileSync ( packageJsonFullPath , 'utf8' ) ; return [ { fileName : packageJsonFullPath , message : 'Use property `types` instead of `typings`.' , severity : 'error' , ... getJSONPropertyPosition ( content , 'typings' ) } ] ; } return [ ] ; } ;