Skip to content

Instantly share code, notes, and snippets.

@jmcrthrs
jmcrthrs / find-jsx-literals.js
Last active December 16, 2021 21:09
finds literals in jsx using eslint, and replaces the string with a react-intl FormattedMessage tag, using the literal string as a key. All keys are saved to a file in JSON format.
var fs = require('fs');
var path = require('path');
var CLIEngine = require('eslint').CLIEngine;
var cli = new CLIEngine({
useEslintrc: true,
});
var report = cli.executeOnFiles([
'**/*.jsx',