UNPKG

@nx/expo

Version:

The Expo Plugin for Nx contains executors and generators for managing and developing an expo application within your workspace. For example, you can directly build for different target platforms as well as generate projects and publish your code.

52 lines (51 loc) 2.11 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.addLinting = addLinting; const eslint_1 = require("@nx/eslint"); const devkit_1 = require("@nx/devkit"); const lint_1 = require("@nx/react/src/utils/lint"); const eslint_file_1 = require("@nx/eslint/src/generators/utils/eslint-file"); const flat_config_1 = require("@nx/eslint/src/utils/flat-config"); async function addLinting(host, options) { if (options.linter === 'none') { return () => { }; } const tasks = []; const lintTask = await (0, eslint_1.lintProjectGenerator)(host, { linter: options.linter, project: options.projectName, tsConfigPaths: options.tsConfigPaths, skipFormat: true, skipPackageJson: options.skipPackageJson, addPlugin: options.addPlugin, }); tasks.push(lintTask); if ((0, eslint_file_1.isEslintConfigSupported)(host)) { if ((0, flat_config_1.useFlatConfig)(host)) { (0, eslint_file_1.addPredefinedConfigToFlatLintConfig)(host, options.projectRoot, 'flat/react'); // Add an empty rules object to users know how to add/override rules (0, eslint_file_1.addOverrideToLintConfig)(host, options.projectRoot, { files: ['*.ts', '*.tsx', '*.js', '*.jsx'], rules: {}, }); } else { const addExtendsTask = (0, eslint_file_1.addExtendsToLintConfig)(host, options.projectRoot, { name: 'plugin:@nx/react', needCompatFixup: true, }); tasks.push(addExtendsTask); } (0, eslint_file_1.addIgnoresToLintConfig)(host, options.projectRoot, [ '.expo', 'web-build', 'cache', 'dist', ]); } if (!options.skipPackageJson) { const installTask = await (0, devkit_1.addDependenciesToPackageJson)(host, lint_1.extraEslintDependencies.dependencies, lint_1.extraEslintDependencies.devDependencies); tasks.push(installTask); } return (0, devkit_1.runTasksInSerial)(...tasks); }