@gfdigital/eslint-config
Version:
A collection of opinionated best practice eslint configs
40 lines (39 loc) • 1.05 kB
JavaScript
import { greenFlashBase } from "./_base.js";
const projectMap = {
monorepo: "packages/*/tsconfig.json",
basic: "tsconfig.json",
};
/**
* A function that returns an eslint config that will set
* linting standards for any combination of a node and react
* typescript project
*/
function ts(options) {
return [
...greenFlashBase,
{
files: ["**/*.{ts,tsx}"],
settings: {
react: {
version: "detect",
},
"import/resolver": {
typescript: {
// Use the TypeScript configuration file
project: projectMap[options.type],
alwaysTryTypes: true,
},
node: {
// Allow resolving node modules
extensions: [".js", ".jsx", ".ts", ".tsx"],
},
},
},
},
];
}
export default {
configs: {
ts,
},
};